package com.ship.dispatch.service.shipBusiness.impl;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.ship.common.business.service.impl.BaseServiceImpl;
import com.ship.common.core.domain.R;
import com.ship.common.core.exception.BusException;
import com.ship.common.core.utils.StringUtils;
import com.ship.common.core.web.domain.BaseResultCode;
import com.ship.common.core.web.domain.JsonResult;
import com.ship.common.security.utils.SecurityUtils;
import com.ship.dispatch.bean.fob.SpFobFileRecord;
import com.ship.dispatch.bean.fob.SpFobJsfhccbItems;
import com.ship.dispatch.bean.shipBusiness.SmThirdPartyMeasure;
import com.ship.dispatch.bean.shipBusiness.SmThirdPartyMeasureRecord;
import com.ship.dispatch.bo.shipBusiness.ThirdPartyMeasureBo;
import com.ship.dispatch.bo.shipBusiness.ThirdPartyMeasureDetailBo;
import com.ship.dispatch.bo.shipBusiness.ThirdPartyMeasureRecordBo;
import com.ship.dispatch.bpm.vo.dto.BGTableDto;
import com.ship.dispatch.mapper.shipBusiness.SmThirdPartyMeasureMapper;
import com.ship.dispatch.mapper.shipBusiness.SmThirdPartyMeasureRecordMapper;
import com.ship.dispatch.service.shipBusiness.SmThirdPartyMeasureService;
import com.ship.dispatch.vo.shipReport.*;
import com.ship.system.api.RemoteFileService;
import com.ship.system.api.domain.SysFile;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.*;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URI;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

@Service
public class SmThirdPartyMeasureServiceImpl extends BaseServiceImpl<SmThirdPartyMeasureMapper, SmThirdPartyMeasure> implements SmThirdPartyMeasureService {

    @Autowired
    private SmThirdPartyMeasureRecordMapper thirdPartyMeasureRecordMapper;

    @Autowired
    private RemoteFileService remoteFileService;

    /**
     * 同步船务管理（第三方计量表）
     *
     * @param thirdPartyMeasureBo
     * @return
     */
    @Override
    public SynchronThirdPartyMeasureVo saveSmThirdPartyMeasure(ThirdPartyMeasureBo thirdPartyMeasureBo) {
        SynchronThirdPartyMeasureVo synchronThirdPartyMeasureVo = new SynchronThirdPartyMeasureVo();
        SmThirdPartyMeasure smThirdPartyMeasure = this.getBaseMapper().selectOne(new LambdaQueryWrapper<SmThirdPartyMeasure>()
                .eq(SmThirdPartyMeasure::getVoyage, thirdPartyMeasureBo.getVoyage()));
        if (null != smThirdPartyMeasure) {
            BeanUtils.copyProperties(thirdPartyMeasureBo, smThirdPartyMeasure);
            //处理船务管理第三方计量字段
            smThirdPartyMeasure = doSmThirdPartyMeasure(smThirdPartyMeasure);
            BeanUtils.copyProperties(smThirdPartyMeasure, synchronThirdPartyMeasureVo);
            this.updateById(smThirdPartyMeasure);
        } else {
            SmThirdPartyMeasure thirdPartyMeasure = new SmThirdPartyMeasure();
            BeanUtils.copyProperties(thirdPartyMeasureBo, thirdPartyMeasure);
            //处理船务管理第三方计量字段
            thirdPartyMeasure = doSmThirdPartyMeasure(thirdPartyMeasure);
            BeanUtils.copyProperties(thirdPartyMeasure, synchronThirdPartyMeasureVo);
            thirdPartyMeasure.setCreateBy(SecurityUtils.getStringUserId());
            thirdPartyMeasure.setCreateDate(new Date());
            this.save(thirdPartyMeasure);
            smThirdPartyMeasure = thirdPartyMeasure;
        }
        synchronThirdPartyMeasureVo.setId(smThirdPartyMeasure.getId());
        return synchronThirdPartyMeasureVo;
    }

    /**
     * 同步船务管理（第三方计量--时间记录日志表）
     *
     * @param thirdPartyMeasureRecordBo
     * @return
     */
    @Override
    public SmThirdPartyMeasureRecord saveSmThirdPartyMeasureRecord(ThirdPartyMeasureRecordBo thirdPartyMeasureRecordBo) {
        SmThirdPartyMeasureRecord thirdPartyMeasureRecord = new SmThirdPartyMeasureRecord();
        BeanUtils.copyProperties(thirdPartyMeasureRecordBo, thirdPartyMeasureRecord);
        thirdPartyMeasureRecordMapper.insert(thirdPartyMeasureRecord);
        return thirdPartyMeasureRecord;
    }

    /**
     * 处理船务管理第三方计量字段
     *
     * @param thirdPartyMeasure
     * @return
     */
    private SmThirdPartyMeasure doSmThirdPartyMeasure(SmThirdPartyMeasure thirdPartyMeasure) {
        BigDecimal change = new BigDecimal(0);
        if (null != thirdPartyMeasure.getDischargeGhvTwo() && null != thirdPartyMeasure.getLoadingGhv()) {
            change = thirdPartyMeasure.getDischargeGhvTwo().subtract(thirdPartyMeasure.getLoadingGhv());
        } else {
            if (thirdPartyMeasure.getDischargeGhv() != null && thirdPartyMeasure.getLoadingGhv() != null) {
                change = thirdPartyMeasure.getDischargeGhv().subtract(thirdPartyMeasure.getLoadingGhv());
            }
        }
        thirdPartyMeasure.setThirdPartyChange(change);

        BigDecimal loadingConversionFactors = new BigDecimal(0);
        if (null != thirdPartyMeasure.getLoadingGrossMmbtuQuantity() && null != thirdPartyMeasure.getLoadingGrossMetersQuantity()) {
            // 设置忽略舍入模式，强制舍去小数位数
            if(!thirdPartyMeasure.getLoadingGrossMetersQuantity().equals(BigDecimal.ZERO)){
                loadingConversionFactors = thirdPartyMeasure.getLoadingGrossMmbtuQuantity().divide(thirdPartyMeasure.getLoadingGrossMetersQuantity(), 4, RoundingMode.DOWN);
            }
            thirdPartyMeasure.setLoadingConversionFactors(loadingConversionFactors);
        }

        BigDecimal loadingConversionFactorsTwo = new BigDecimal(0);
        if (null != thirdPartyMeasure.getLoadingGrossMmbtuQuantityTwo() && null != thirdPartyMeasure.getLoadingGrossMetersQuantityTwo()) {
            // 设置忽略舍入模式，强制舍去小数位数
            if(!thirdPartyMeasure.getLoadingGrossMetersQuantityTwo().equals(BigDecimal.ZERO)){
                loadingConversionFactorsTwo = thirdPartyMeasure.getLoadingGrossMmbtuQuantityTwo().divide(thirdPartyMeasure.getLoadingGrossMetersQuantityTwo(), 4, RoundingMode.DOWN);
            }
            thirdPartyMeasure.setLoadingConversionFactorsTwo(loadingConversionFactorsTwo);
        }

        BigDecimal dischargeConversionFactors = new BigDecimal(0);
        if (null != thirdPartyMeasure.getDischargeGrossMmbtuQuantity() && null != thirdPartyMeasure.getDischargeGrossMetersQuantity()) {
            // 设置忽略舍入模式，强制舍去小数位数
            if(!thirdPartyMeasure.getDischargeGrossMetersQuantity().equals(BigDecimal.ZERO)){
                dischargeConversionFactors = thirdPartyMeasure.getDischargeGrossMmbtuQuantity().divide(thirdPartyMeasure.getDischargeGrossMetersQuantity(), 4, RoundingMode.DOWN);
            }
            thirdPartyMeasure.setDischargeConversionFactors(dischargeConversionFactors);
        }

        BigDecimal dischargeConversionFactorsTwo = new BigDecimal(0);
        if (null != thirdPartyMeasure.getDischargeGrossMmbtuQuantityTwo() && null != thirdPartyMeasure.getDischargeGrossMetersQuantityTwo()) {
            // 设置忽略舍入模式，强制舍去小数位数
            if(!thirdPartyMeasure.getDischargeGrossMetersQuantityTwo().equals(BigDecimal.ZERO)) {
                dischargeConversionFactorsTwo = thirdPartyMeasure.getDischargeGrossMmbtuQuantityTwo().divide(thirdPartyMeasure.getDischargeGrossMetersQuantityTwo(), 4, RoundingMode.DOWN);
            }
            thirdPartyMeasure.setDischargeConversionFactorsTwo(dischargeConversionFactorsTwo);
        }

        return thirdPartyMeasure;
    }

    /**
     * 船务管理-第三方计量详情
     *
     * @param id
     * @return
     */
    @Override
    public ThirdPartyMeasureDetailAllVo selectThirdPartyMeasureDetail(Long id, List<SpFobFileRecord> fileRecords) {
        ThirdPartyMeasureDetailAllVo thirdPartyMeasureDetailAllVo = new ThirdPartyMeasureDetailAllVo();
        List<ThirdPartyMeasureDetailFileVo> file = new ArrayList<>();
        List<ThirdPartyMeasureDetailVo> detailVos = new ArrayList<>();
        SmThirdPartyMeasure thirdPartyMeasure = this.getBaseMapper().selectById(id);
        if (null != thirdPartyMeasure) {
            //一共5个小表格
            for (int i = 1; i <= 5; i++) {
                //各个表格通用表头
                ThirdPartyMeasureDetailVo thirdPartyMeasureDetailVo = new ThirdPartyMeasureDetailVo();
                thirdPartyMeasureDetailVo.setFormId("a" + i);
                if (i == 1) {
                    String loadingPort = "";
                    if (StringUtils.isNotEmpty(thirdPartyMeasure.getLoadingPort())){
                       String str = thirdPartyMeasure.getLoadingPort();
                        String[] split = str.split("-");
                        if (split.length >= 2){
                            loadingPort = loadingPort+ split[1];
                        }else {
                            loadingPort = split[0];
                        }

                    }
                    String dischargePort = "";
                    if (StringUtils.isNotEmpty(thirdPartyMeasure.getDischargePort())){
                        String str = thirdPartyMeasure.getDischargePort();
                        String[] split = str.split("-");
                        if (split.length >= 2){
                            dischargePort = dischargePort+split[1];
                        }else {
                            dischargePort = split[0];
                        }

                    }
                    thirdPartyMeasureDetailVo.setFormTitle(thirdPartyMeasure.getVoyage()+"/"+loadingPort+"/"+dischargePort);
                } else if (i == 2) {
                    thirdPartyMeasureDetailVo.setFormTitle("Quantity");
                } else if (i == 3) {
                    thirdPartyMeasureDetailVo.setFormTitle("Component");
                } else if (i == 4) {
                    thirdPartyMeasureDetailVo.setFormTitle("Loading Time Log");
                } else if (i == 5) {
                    thirdPartyMeasureDetailVo.setFormTitle("Discharge Time Log");
                }
                List<ThirdPartyMeasureBaseVo> column = new ArrayList<>();
                ThirdPartyMeasureBaseVo thirdPartyMeasureBaseVo1 = new ThirdPartyMeasureBaseVo();
                thirdPartyMeasureBaseVo1.setTitle("");
                thirdPartyMeasureBaseVo1.setKey("firstColumn");
                thirdPartyMeasureBaseVo1.setColSpan(1);
                column.add(thirdPartyMeasureBaseVo1);

                ThirdPartyMeasureBaseVo thirdPartyMeasureBaseVo2 = new ThirdPartyMeasureBaseVo();
                thirdPartyMeasureBaseVo2.setTitle("Loading");
                thirdPartyMeasureBaseVo2.setColSpan(2);
                List<ThirdPartyMeasureChildrenVo> children = new ArrayList<>();
                ThirdPartyMeasureChildrenVo childrenVo1 = new ThirdPartyMeasureChildrenVo();
                childrenVo1.setTitle("Loading1");
                childrenVo1.setKey("Loading1");
                childrenVo1.setColSpan(0);
                ThirdPartyMeasureChildrenVo childrenVo2 = new ThirdPartyMeasureChildrenVo();
                childrenVo2.setTitle("Loading2");
                childrenVo2.setKey("Loading2");
                childrenVo2.setColSpan(0);
                children.add(childrenVo1);
                children.add(childrenVo2);
                thirdPartyMeasureBaseVo2.setChildren(children);
                column.add(thirdPartyMeasureBaseVo2);

                //航次类型（1：一港装载一港卸载，2：一港装载两港卸载，3：两港装载一港卸载，4：两港装载两港卸载，5：FOB 销售只有装载第三方计量）
                if (thirdPartyMeasure.getVoyageType().equals(3) || thirdPartyMeasure.getVoyageType().equals(4)) {
                    //两装载港
                    ThirdPartyMeasureBaseVo thirdPartyMeasureBaseLoadingVo2 = new ThirdPartyMeasureBaseVo();
                    thirdPartyMeasureBaseLoadingVo2.setTitle("Loading-2");
                    thirdPartyMeasureBaseLoadingVo2.setColSpan(2);
                    List<ThirdPartyMeasureChildrenVo> childrenLoading = new ArrayList<>();
                    ThirdPartyMeasureChildrenVo childrenLoadingVo1 = new ThirdPartyMeasureChildrenVo();
                    childrenLoadingVo1.setTitle("Loading-2-1");
                    childrenLoadingVo1.setKey("Loading-2-1");
                    childrenLoadingVo1.setColSpan(0);
                    ThirdPartyMeasureChildrenVo childrenLoadingVo2 = new ThirdPartyMeasureChildrenVo();
                    childrenLoadingVo2.setTitle("Loading-2-2");
                    childrenLoadingVo2.setKey("Loading-2-2");
                    childrenLoadingVo2.setColSpan(0);
                    childrenLoading.add(childrenLoadingVo1);
                    childrenLoading.add(childrenLoadingVo2);
                    thirdPartyMeasureBaseLoadingVo2.setChildren(childrenLoading);
                    column.add(thirdPartyMeasureBaseLoadingVo2);
                }
                //卸载港
                if (thirdPartyMeasure.getVoyageType().equals(1) || thirdPartyMeasure.getVoyageType().equals(3)) {
                    //一卸载
                    ThirdPartyMeasureBaseVo thirdPartyMeasureBaseDischargeVo = new ThirdPartyMeasureBaseVo();
                    thirdPartyMeasureBaseDischargeVo.setTitle("Discharge");
                    thirdPartyMeasureBaseDischargeVo.setColSpan(2);
                    List<ThirdPartyMeasureChildrenVo> childrenDischarge = new ArrayList<>();
                    ThirdPartyMeasureChildrenVo childrenDischargeVo1 = new ThirdPartyMeasureChildrenVo();
                    childrenDischargeVo1.setTitle("Discharge1");
                    childrenDischargeVo1.setKey("Discharge1");
                    childrenDischargeVo1.setColSpan(0);
                    ThirdPartyMeasureChildrenVo childrenDischargeVo2 = new ThirdPartyMeasureChildrenVo();
                    childrenDischargeVo2.setTitle("Discharge2");
                    childrenDischargeVo2.setKey("Discharge2");
                    childrenDischargeVo2.setColSpan(0);
                    childrenDischarge.add(childrenDischargeVo1);
                    childrenDischarge.add(childrenDischargeVo2);
                    thirdPartyMeasureBaseDischargeVo.setChildren(childrenDischarge);
                    column.add(thirdPartyMeasureBaseDischargeVo);
                } else if (thirdPartyMeasure.getVoyageType().equals(2) || thirdPartyMeasure.getVoyageType().equals(4)) {
                    //两卸载
                    ThirdPartyMeasureBaseVo thirdPartyMeasureBaseDischargeVo2 = new ThirdPartyMeasureBaseVo();
                    thirdPartyMeasureBaseDischargeVo2.setTitle("Discharge-2");
                    thirdPartyMeasureBaseDischargeVo2.setColSpan(2);
                    List<ThirdPartyMeasureChildrenVo> childrenDischarge2 = new ArrayList<>();
                    ThirdPartyMeasureChildrenVo childrenDischargeVo1 = new ThirdPartyMeasureChildrenVo();
                    childrenDischargeVo1.setTitle("Discharge-2-1");
                    childrenDischargeVo1.setKey("Discharge-2-1");
                    childrenDischargeVo1.setColSpan(0);
                    ThirdPartyMeasureChildrenVo childrenDischargeVo2 = new ThirdPartyMeasureChildrenVo();
                    childrenDischargeVo2.setTitle("Discharge-2-2");
                    childrenDischargeVo2.setKey("Discharge-2-2");
                    childrenDischargeVo2.setColSpan(0);
                    childrenDischarge2.add(childrenDischargeVo1);
                    childrenDischarge2.add(childrenDischargeVo2);
                    thirdPartyMeasureBaseDischargeVo2.setChildren(childrenDischarge2);
                    column.add(thirdPartyMeasureBaseDischargeVo2);
                }
                ThirdPartyMeasureBaseVo thirdPartyMeasureBaseVo3 = new ThirdPartyMeasureBaseVo();
                thirdPartyMeasureBaseVo3.setTitle("Remarks");
                thirdPartyMeasureBaseVo3.setKey("Remarks");
                thirdPartyMeasureBaseVo3.setColSpan(1);
                column.add(thirdPartyMeasureBaseVo3);

                thirdPartyMeasureDetailVo.setColumn(column);

                List<JSONObject> data = new ArrayList<>();
                if (i == 1) {
                    //第一个表格内容
                    JSONObject jsonObject = new JSONObject();
                    JSONObject jsonObject1 = new JSONObject();
                    JSONObject jsonObject2 = new JSONObject();
                    JSONObject jsonObject3 = new JSONObject();
                    jsonObject.put("firstColumn", "Port");
                    jsonObject1.put("firstColumn", "Start Date");
                    jsonObject2.put("firstColumn", "End Date");
                    jsonObject3.put("firstColumn", "Independent");
//                    data.add(jsonObject);
//                    data.add(jsonObject1);
//                    data.add(jsonObject2);
//                    data.add(jsonObject3);
                    jsonObject.put("Loading1", thirdPartyMeasure.getLoadingPort());
                    jsonObject1.put("Loading1", DateUtil.format(thirdPartyMeasure.getLoadingStartDate(), DatePattern.NORM_DATE_FORMATTER));
                    jsonObject2.put("Loading1", DateUtil.format(thirdPartyMeasure.getLoadingEndDate(),DatePattern.NORM_DATE_FORMATTER));
                    jsonObject3.put("Loading1", thirdPartyMeasure.getLoadingIndependent());
//                    data.add(jsonObject);
//                    data.add(jsonObject1);
//                    data.add(jsonObject2);
//                    data.add(jsonObject3);
                    jsonObject.put("Loading2", "");
                    jsonObject1.put("Loading2", "");
                    jsonObject2.put("Loading2", "");
                    jsonObject3.put("Loading2", "");
//                    data.add(jsonObject);
//                    data.add(jsonObject1);
//                    data.add(jsonObject2);
//                    data.add(jsonObject3);
                    jsonObject.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject1.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject2.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject3.put("Remarks", thirdPartyMeasure.getRemarks());
//                    data.add(jsonObject);
//                    data.add(jsonObject1);
//                    data.add(jsonObject2);
//                    data.add(jsonObject3);
                    if (thirdPartyMeasure.getVoyageType().equals(3) || thirdPartyMeasure.getVoyageType().equals(4)) {
                        //两装载港
                        jsonObject.put("Loading-2-1", thirdPartyMeasure.getLoadingPortTwo());
                        jsonObject1.put("Loading-2-1", DateUtil.format(thirdPartyMeasure.getLoadingStartDateTwo(), DatePattern.NORM_DATE_FORMATTER));
                        jsonObject2.put("Loading-2-1", DateUtil.format(thirdPartyMeasure.getLoadingEndDateTwo(), DatePattern.NORM_DATE_FORMATTER));
                        jsonObject3.put("Loading-2-1", thirdPartyMeasure.getLoadingIndependentTwo());
//                        data.add(jsonObject);
//                        data.add(jsonObject1);
//                        data.add(jsonObject2);
//                        data.add(jsonObject3);
                        jsonObject.put("Loading-2-2", "");
                        jsonObject1.put("Loading-2-2", "");
                        jsonObject2.put("Loading-2-2", "");
                        jsonObject3.put("Loading-2-2", "");
//                        data.add(jsonObject);
//                        data.add(jsonObject1);
//                        data.add(jsonObject2);
//                        data.add(jsonObject3);
                    }
                    if (thirdPartyMeasure.getVoyageType().equals(1) || thirdPartyMeasure.getVoyageType().equals(3)) {
                        //一卸载
                        jsonObject.put("Discharge1", thirdPartyMeasure.getDischargePort());
                        jsonObject1.put("Discharge1", DateUtil.format(thirdPartyMeasure.getDischargeStartDate(), DatePattern.NORM_DATE_FORMATTER));
                        jsonObject2.put("Discharge1", DateUtil.format(thirdPartyMeasure.getDischargeEndDate(), DatePattern.NORM_DATE_FORMATTER));
                        jsonObject3.put("Discharge1", thirdPartyMeasure.getDischargeIndependent());
//                        data.add(jsonObject);
//                        data.add(jsonObject1);
//                        data.add(jsonObject2);
//                        data.add(jsonObject3);
                        jsonObject.put("Discharge2", "");
                        jsonObject1.put("Discharge2", "");
                        jsonObject2.put("Discharge2", "");
                        jsonObject3.put("Discharge2", "");
//                        data.add(jsonObject);
//                        data.add(jsonObject1);
//                        data.add(jsonObject2);
//                        data.add(jsonObject3);
                    } else if (thirdPartyMeasure.getVoyageType().equals(2) || thirdPartyMeasure.getVoyageType().equals(4)) {
                        //两卸载
                        jsonObject.put("Discharge-2-1", thirdPartyMeasure.getDischargePortTwo());
                        jsonObject1.put("Discharge-2-1", DateUtil.format(thirdPartyMeasure.getDischargeStartDateTwo(), DatePattern.NORM_DATE_FORMATTER));
                        jsonObject2.put("Discharge-2-1", DateUtil.format(thirdPartyMeasure.getDischargeEndDateTwo(), DatePattern.NORM_DATE_FORMATTER));
                        jsonObject3.put("Discharge-2-1", thirdPartyMeasure.getDischargeIndependentTwo());
//                        data.add(jsonObject);
//                        data.add(jsonObject1);
//                        data.add(jsonObject2);
//                        data.add(jsonObject3);
                        jsonObject.put("Discharge-2-2", "");
                        jsonObject1.put("Discharge-2-2", "");
                        jsonObject2.put("Discharge-2-2", "");
                        jsonObject3.put("Discharge-2-2", "");
//                        data.add(jsonObject);
//                        data.add(jsonObject1);
//                        data.add(jsonObject2);
//                        data.add(jsonObject3);
                    }
                    data.add(jsonObject);
                    data.add(jsonObject1);
                    data.add(jsonObject2);
                    data.add(jsonObject3);
                    thirdPartyMeasureDetailVo.setData(data);
                } else if (i == 2) {
                    //第二个表格内容
                    JSONObject jsonObject1 = new JSONObject();
                    JSONObject jsonObject2 = new JSONObject();
                    JSONObject jsonObject3 = new JSONObject();
                    JSONObject jsonObject4 = new JSONObject();
                    JSONObject jsonObject5 = new JSONObject();
                    JSONObject jsonObject6 = new JSONObject();
                    JSONObject jsonObject7 = new JSONObject();
                    JSONObject jsonObject8 = new JSONObject();
                    JSONObject jsonObject9 = new JSONObject();
                    JSONObject jsonObject10 = new JSONObject();
                    JSONObject jsonObject11 = new JSONObject();
                    JSONObject jsonObject12 = new JSONObject();
                    JSONObject jsonObject13 = new JSONObject();
                    JSONObject jsonObject14 = new JSONObject();
                    JSONObject jsonObject15 = new JSONObject();
                    JSONObject jsonObject16 = new JSONObject();
                    JSONObject jsonObject17 = new JSONObject();
                    JSONObject jsonObject18 = new JSONObject();
                    JSONObject jsonObject19 = new JSONObject();
                    JSONObject jsonObject20 = new JSONObject();
                    JSONObject jsonObject21 = new JSONObject();
                    JSONObject jsonObject22 = new JSONObject();

                    jsonObject1.put("firstColumn", "Gross Quantity");
                    jsonObject11.put("firstColumn", "Gross Quantity");
                    jsonObject12.put("firstColumn", "Gross Quantity");
                    jsonObject2.put("firstColumn", "Net Quantity");
                    jsonObject13.put("firstColumn", "Net Quantity");
                    jsonObject14.put("firstColumn", "Net Quantity");
                    jsonObject3.put("firstColumn", "COOL DOWN");
                    jsonObject15.put("firstColumn", "COOL DOWN");
                    jsonObject16.put("firstColumn", "COOL DOWN");
                    jsonObject4.put("firstColumn", "VAPOUR");
                    jsonObject17.put("firstColumn", "VAPOUR");
                    jsonObject18.put("firstColumn", "VAPOUR");
                    jsonObject5.put("firstColumn", "BOG CONSUMED");
                    jsonObject19.put("firstColumn", "BOG CONSUMED");
                    jsonObject20.put("firstColumn", "BOG CONSUMED");
                    jsonObject6.put("firstColumn", "GASSING UP");
                    jsonObject21.put("firstColumn", "GASSING UP");
                    jsonObject22.put("firstColumn", "GASSING UP");
                    jsonObject7.put("firstColumn", "GHV");
                    jsonObject8.put("firstColumn", "Temperature");
                    jsonObject9.put("firstColumn", "Density");
                    jsonObject10.put("firstColumn", "气化率");
//                    data.add(jsonObject1);
//                    data.add(jsonObject2);
//                    data.add(jsonObject3);
//                    data.add(jsonObject4);
//                    data.add(jsonObject5);
//                    data.add(jsonObject6);
//                    data.add(jsonObject7);
//                    data.add(jsonObject8);
//                    data.add(jsonObject9);
//                    data.add(jsonObject10);
                    jsonObject1.put("Loading1", thirdPartyMeasure.getLoadingGrossMmbtuQuantity());
                    jsonObject11.put("Loading1", thirdPartyMeasure.getLoadingGrossTonsQuantity());
                    jsonObject12.put("Loading1", thirdPartyMeasure.getLoadingGrossMetersQuantity());
                    jsonObject2.put("Loading1", thirdPartyMeasure.getLoadingNetMmbtuQuantity());
                    jsonObject13.put("Loading1", thirdPartyMeasure.getLoadingNetTonsQuantity());
                    jsonObject14.put("Loading1", thirdPartyMeasure.getLoadingNetMetersQuantity());
                    jsonObject3.put("Loading1", thirdPartyMeasure.getLoadingCoolMmbtuQuantity());
                    jsonObject15.put("Loading1", thirdPartyMeasure.getLoadingCoolTonsQuantity());
                    jsonObject16.put("Loading1", thirdPartyMeasure.getLoadingCoolMetersQuantity());
                    jsonObject4.put("Loading1", thirdPartyMeasure.getLoadingVapourMmbtuQuantity());
                    jsonObject17.put("Loading1", thirdPartyMeasure.getLoadingVapourTonsQuantity());
                    jsonObject18.put("Loading1", thirdPartyMeasure.getLoadingVapourMetersQuantity());
                    jsonObject5.put("Loading1", thirdPartyMeasure.getLoadingConsumedMmbtuQuantity());
                    jsonObject19.put("Loading1", thirdPartyMeasure.getLoadingConsumedTonsQuantity());
                    jsonObject20.put("Loading1", thirdPartyMeasure.getLoadingConsumedMetersQuantity());
                    jsonObject6.put("Loading1", thirdPartyMeasure.getLoadingGassingMmbtuQuantity());
                    jsonObject21.put("Loading1", thirdPartyMeasure.getLoadingGassingTonsQuantity());
                    jsonObject22.put("Loading1", thirdPartyMeasure.getLoadingGassingMetersQuantity());
                    jsonObject7.put("Loading1", thirdPartyMeasure.getLoadingGhv());
                    jsonObject8.put("Loading1", thirdPartyMeasure.getLoadingTemperature());
                    jsonObject9.put("Loading1", thirdPartyMeasure.getLoadingDensity());
                    jsonObject10.put("Loading1", thirdPartyMeasure.getLoadingGas());
//                    data.add(jsonObject1);
//                    data.add(jsonObject11);
//                    data.add(jsonObject12);
//                    data.add(jsonObject2);
//                    data.add(jsonObject13);
//                    data.add(jsonObject14);
//                    data.add(jsonObject3);
//                    data.add(jsonObject15);
//                    data.add(jsonObject16);
//                    data.add(jsonObject4);
//                    data.add(jsonObject17);
//                    data.add(jsonObject18);
//                    data.add(jsonObject5);
//                    data.add(jsonObject19);
//                    data.add(jsonObject20);
//                    data.add(jsonObject6);
//                    data.add(jsonObject21);
//                    data.add(jsonObject22);
//                    data.add(jsonObject7);
//                    data.add(jsonObject8);
//                    data.add(jsonObject9);
//                    data.add(jsonObject10);
                    jsonObject1.put("Loading2", "MMBtu");
                    jsonObject11.put("Loading2", "Metric Tons");
                    jsonObject12.put("Loading2", "Cubic Meters");
                    jsonObject2.put("Loading2", "MMBtu");
                    jsonObject13.put("Loading2", "Metric Tons");
                    jsonObject14.put("Loading2", "Cubic Meters");
                    jsonObject3.put("Loading2", "MMBtu");
                    jsonObject15.put("Loading2", "Metric Tons");
                    jsonObject16.put("Loading2", "Cubic Meters");
                    jsonObject4.put("Loading2", "MMBtu");
                    jsonObject17.put("Loading2", "Metric Tons");
                    jsonObject18.put("Loading2", "Cubic Meters");
                    jsonObject5.put("Loading2", "MMBtu");
                    jsonObject19.put("Loading2", "Metric Tons");
                    jsonObject20.put("Loading2", "Cubic Meters");
                    jsonObject6.put("Loading2", "MMBtu");
                    jsonObject21.put("Loading2", "Metric Tons");
                    jsonObject22.put("Loading2", "Cubic Meters");
                    jsonObject7.put("Loading2", "Btu/scf");
                    jsonObject8.put("Loading2", "℃");
                    jsonObject9.put("Loading2", "kg/m³");
                    jsonObject10.put("Loading2", "m³/MT");
//                    data.add(jsonObject1);
//                    data.add(jsonObject11);
//                    data.add(jsonObject12);
//                    data.add(jsonObject2);
//                    data.add(jsonObject13);
//                    data.add(jsonObject14);
//                    data.add(jsonObject3);
//                    data.add(jsonObject15);
//                    data.add(jsonObject16);
//                    data.add(jsonObject4);
//                    data.add(jsonObject17);
//                    data.add(jsonObject18);
//                    data.add(jsonObject5);
//                    data.add(jsonObject19);
//                    data.add(jsonObject20);
//                    data.add(jsonObject6);
//                    data.add(jsonObject21);
//                    data.add(jsonObject22);
//                    data.add(jsonObject7);
//                    data.add(jsonObject8);
//                    data.add(jsonObject9);
//                    data.add(jsonObject10);
                    jsonObject1.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject11.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject12.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject2.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject13.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject14.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject3.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject15.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject16.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject4.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject17.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject18.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject5.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject19.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject20.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject6.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject21.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject22.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject7.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject8.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject9.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject10.put("Remarks", thirdPartyMeasure.getRemarks());
//                    data.add(jsonObject1);
//                    data.add(jsonObject11);
//                    data.add(jsonObject12);
//                    data.add(jsonObject2);
//                    data.add(jsonObject13);
//                    data.add(jsonObject14);
//                    data.add(jsonObject3);
//                    data.add(jsonObject15);
//                    data.add(jsonObject16);
//                    data.add(jsonObject4);
//                    data.add(jsonObject17);
//                    data.add(jsonObject18);
//                    data.add(jsonObject5);
//                    data.add(jsonObject19);
//                    data.add(jsonObject20);
//                    data.add(jsonObject6);
//                    data.add(jsonObject21);
//                    data.add(jsonObject22);
//                    data.add(jsonObject7);
//                    data.add(jsonObject8);
//                    data.add(jsonObject9);
//                    data.add(jsonObject10);
                    if (thirdPartyMeasure.getVoyageType().equals(3) || thirdPartyMeasure.getVoyageType().equals(4)) {
                        //两装载港
                        jsonObject1.put("Loading-2-1", thirdPartyMeasure.getLoadingGrossMmbtuQuantityTwo());
                        jsonObject11.put("Loading-2-1", thirdPartyMeasure.getLoadingGrossTonsQuantityTwo());
                        jsonObject12.put("Loading-2-1", thirdPartyMeasure.getLoadingGrossMetersQuantityTwo());
                        jsonObject2.put("Loading-2-1", thirdPartyMeasure.getLoadingNetMmbtuQuantityTwo());
                        jsonObject13.put("Loading-2-1", thirdPartyMeasure.getLoadingNetTonsQuantityTwo());
                        jsonObject14.put("Loading-2-1", thirdPartyMeasure.getLoadingNetMetersQuantityTwo());
                        jsonObject3.put("Loading-2-1", thirdPartyMeasure.getLoadingCoolMmbtuQuantityTwo());
                        jsonObject15.put("Loading-2-1", thirdPartyMeasure.getLoadingCoolTonsQuantityTwo());
                        jsonObject16.put("Loading-2-1", thirdPartyMeasure.getLoadingCoolMetersQuantityTwo());
                        jsonObject4.put("Loading-2-1", thirdPartyMeasure.getLoadingVapourMmbtuQuantityTwo());
                        jsonObject17.put("Loading-2-1", thirdPartyMeasure.getLoadingVapourTonsQuantityTwo());
                        jsonObject18.put("Loading-2-1", thirdPartyMeasure.getLoadingVapourMetersQuantityTwo());
                        jsonObject5.put("Loading-2-1", thirdPartyMeasure.getLoadingConsumedMmbtuQuantityTwo());
                        jsonObject19.put("Loading-2-1", thirdPartyMeasure.getLoadingConsumedTonsQuantityTwo());
                        jsonObject20.put("Loading-2-1", thirdPartyMeasure.getLoadingConsumedMetersQuantityTwo());
                        jsonObject6.put("Loading-2-1", thirdPartyMeasure.getLoadingGassingMmbtuQuantityTwo());
                        jsonObject21.put("Loading-2-1", thirdPartyMeasure.getLoadingGassingTonsQuantityTwo());
                        jsonObject22.put("Loading-2-1", thirdPartyMeasure.getLoadingGassingMetersQuantityTwo());
                        jsonObject7.put("Loading-2-1", thirdPartyMeasure.getLoadingGhvTwo());
                        jsonObject8.put("Loading-2-1", thirdPartyMeasure.getLoadingTemperatureTwo());
                        jsonObject9.put("Loading-2-1", thirdPartyMeasure.getLoadingDensityTwo());
                        jsonObject10.put("Loading-2-1", thirdPartyMeasure.getLoadingGasTwo());
//                        data.add(jsonObject1);
//                        data.add(jsonObject11);
//                        data.add(jsonObject12);
//                        data.add(jsonObject2);
//                        data.add(jsonObject13);
//                        data.add(jsonObject14);
//                        data.add(jsonObject3);
//                        data.add(jsonObject15);
//                        data.add(jsonObject16);
//                        data.add(jsonObject4);
//                        data.add(jsonObject17);
//                        data.add(jsonObject18);
//                        data.add(jsonObject5);
//                        data.add(jsonObject19);
//                        data.add(jsonObject20);
//                        data.add(jsonObject6);
//                        data.add(jsonObject21);
//                        data.add(jsonObject22);
//                        data.add(jsonObject7);
//                        data.add(jsonObject8);
//                        data.add(jsonObject9);
//                        data.add(jsonObject10);

                        jsonObject1.put("Loading-2-2", "MMBtu");
                        jsonObject11.put("Loading-2-2", "Metric Tons");
                        jsonObject12.put("Loading-2-2", "Cubic Meters");
                        jsonObject2.put("Loading-2-2", "MMBtu");
                        jsonObject13.put("Loading-2-2", "Metric Tons");
                        jsonObject14.put("Loading-2-2", "Cubic Meters");
                        jsonObject3.put("Loading-2-2", "MMBtu");
                        jsonObject15.put("Loading-2-2", "Metric Tons");
                        jsonObject16.put("Loading-2-2", "Cubic Meters");
                        jsonObject4.put("Loading-2-2", "MMBtu");
                        jsonObject17.put("Loading-2-2", "Metric Tons");
                        jsonObject18.put("Loading-2-2", "Cubic Meters");
                        jsonObject5.put("Loading-2-2", "MMBtu");
                        jsonObject19.put("Loading-2-2", "Metric Tons");
                        jsonObject20.put("Loading-2-2", "Cubic Meters");
                        jsonObject6.put("Loading-2-2", "MMBtu");
                        jsonObject21.put("Loading-2-2", "Metric Tons");
                        jsonObject22.put("Loading-2-2", "Cubic Meters");
                        jsonObject7.put("Loading-2-2", "Btu/scf");
                        jsonObject8.put("Loading-2-2", "℃");
                        jsonObject9.put("Loading-2-2", "kg/m³");
                        jsonObject10.put("Loading-2-2", "m³/MT");
//                        data.add(jsonObject1);
//                        data.add(jsonObject11);
//                        data.add(jsonObject12);
//                        data.add(jsonObject2);
//                        data.add(jsonObject13);
//                        data.add(jsonObject14);
//                        data.add(jsonObject3);
//                        data.add(jsonObject15);
//                        data.add(jsonObject16);
//                        data.add(jsonObject4);
//                        data.add(jsonObject17);
//                        data.add(jsonObject18);
//                        data.add(jsonObject5);
//                        data.add(jsonObject19);
//                        data.add(jsonObject20);
//                        data.add(jsonObject6);
//                        data.add(jsonObject21);
//                        data.add(jsonObject22);
//                        data.add(jsonObject7);
//                        data.add(jsonObject8);
//                        data.add(jsonObject9);
//                        data.add(jsonObject10);
                    }
                    if (thirdPartyMeasure.getVoyageType().equals(1) || thirdPartyMeasure.getVoyageType().equals(3)) {
                        //一卸载
                        jsonObject1.put("Discharge1", thirdPartyMeasure.getDischargeGrossMmbtuQuantity());
                        jsonObject11.put("Discharge1", thirdPartyMeasure.getDischargeGrossTonsQuantity());
                        jsonObject12.put("Discharge1", thirdPartyMeasure.getDischargeGrossMetersQuantity());
                        jsonObject2.put("Discharge1", thirdPartyMeasure.getDischargeNetMmbtuQuantity());
                        jsonObject13.put("Discharge1", thirdPartyMeasure.getDischargeNetTonsQuantity());
                        jsonObject14.put("Discharge1", thirdPartyMeasure.getDischargeNetMetersQuantity());
                        jsonObject3.put("Discharge1", thirdPartyMeasure.getDischargeCoolMmbtuQuantity());
                        jsonObject15.put("Discharge1", thirdPartyMeasure.getDischargeCoolTonsQuantity());
                        jsonObject16.put("Discharge1", thirdPartyMeasure.getDischargeCoolMetersQuantity());
                        jsonObject4.put("Discharge1", thirdPartyMeasure.getDischargeVapourMmbtuQuantity());
                        jsonObject17.put("Discharge1", thirdPartyMeasure.getDischargeVapourTonsQuantity());
                        jsonObject18.put("Discharge1", thirdPartyMeasure.getDischargeVapourMetersQuantity());
                        jsonObject5.put("Discharge1", thirdPartyMeasure.getDischargeConsumedMmbtuQuantity());
                        jsonObject19.put("Discharge1", thirdPartyMeasure.getDischargeConsumedTonsQuantity());
                        jsonObject20.put("Discharge1", thirdPartyMeasure.getDischargeConsumedMetersQuantity());
                        jsonObject6.put("Discharge1", thirdPartyMeasure.getDischargeGassingMmbtuQuantity());
                        jsonObject21.put("Discharge1", thirdPartyMeasure.getDischargeGassingTonsQuantity());
                        jsonObject22.put("Discharge1", thirdPartyMeasure.getDischargeGassingMetersQuantity());
                        jsonObject7.put("Discharge1", thirdPartyMeasure.getDischargeGhv());
                        jsonObject8.put("Discharge1", thirdPartyMeasure.getDischargeTemperature());
                        jsonObject9.put("Discharge1", thirdPartyMeasure.getDischargeDensity());
                        jsonObject10.put("Discharge1", thirdPartyMeasure.getDischargeGas());
//                        data.add(jsonObject1);
//                        data.add(jsonObject11);
//                        data.add(jsonObject12);
//                        data.add(jsonObject2);
//                        data.add(jsonObject13);
//                        data.add(jsonObject14);
//                        data.add(jsonObject3);
//                        data.add(jsonObject15);
//                        data.add(jsonObject16);
//                        data.add(jsonObject4);
//                        data.add(jsonObject17);
//                        data.add(jsonObject18);
//                        data.add(jsonObject5);
//                        data.add(jsonObject19);
//                        data.add(jsonObject20);
//                        data.add(jsonObject6);
//                        data.add(jsonObject21);
//                        data.add(jsonObject22);
//                        data.add(jsonObject7);
//                        data.add(jsonObject8);
//                        data.add(jsonObject9);
//                        data.add(jsonObject10);

                        jsonObject1.put("Discharge2", "MMBtu");
                        jsonObject11.put("Discharge2", "Metric Tons");
                        jsonObject12.put("Discharge2", "Cubic Meters");
                        jsonObject2.put("Discharge2", "MMBtu");
                        jsonObject13.put("Discharge2", "Metric Tons");
                        jsonObject14.put("Discharge2", "Cubic Meters");
                        jsonObject3.put("Discharge2", "MMBtu");
                        jsonObject15.put("Discharge2", "Metric Tons");
                        jsonObject16.put("Discharge2", "Cubic Meters");
                        jsonObject4.put("Discharge2", "MMBtu");
                        jsonObject17.put("Discharge2", "Metric Tons");
                        jsonObject18.put("Discharge2", "Cubic Meters");
                        jsonObject5.put("Discharge2", "MMBtu");
                        jsonObject19.put("Discharge2", "Metric Tons");
                        jsonObject20.put("Discharge2", "Cubic Meters");
                        jsonObject6.put("Discharge2", "MMBtu");
                        jsonObject21.put("Discharge2", "Metric Tons");
                        jsonObject22.put("Discharge2", "Cubic Meters");
                        jsonObject7.put("Discharge2", "Btu/scf");
                        jsonObject8.put("Discharge2", "℃");
                        jsonObject9.put("Discharge2", "kg/m³");
                        jsonObject10.put("Discharge2", "m³/MT");
//                        data.add(jsonObject1);
//                        data.add(jsonObject11);
//                        data.add(jsonObject12);
//                        data.add(jsonObject2);
//                        data.add(jsonObject13);
//                        data.add(jsonObject14);
//                        data.add(jsonObject3);
//                        data.add(jsonObject15);
//                        data.add(jsonObject16);
//                        data.add(jsonObject4);
//                        data.add(jsonObject17);
//                        data.add(jsonObject18);
//                        data.add(jsonObject5);
//                        data.add(jsonObject19);
//                        data.add(jsonObject20);
//                        data.add(jsonObject6);
//                        data.add(jsonObject21);
//                        data.add(jsonObject22);
//                        data.add(jsonObject7);
//                        data.add(jsonObject8);
//                        data.add(jsonObject9);
//                        data.add(jsonObject10);
                    } else if (thirdPartyMeasure.getVoyageType().equals(2) || thirdPartyMeasure.getVoyageType().equals(4)) {
                        //两卸载
                        jsonObject1.put("Discharge-2-1", thirdPartyMeasure.getDischargeGrossMmbtuQuantityTwo());
                        jsonObject11.put("Discharge-2-1", thirdPartyMeasure.getDischargeGrossTonsQuantityTwo());
                        jsonObject12.put("Discharge-2-1", thirdPartyMeasure.getDischargeGrossMetersQuantityTwo());
                        jsonObject2.put("Discharge-2-1", thirdPartyMeasure.getDischargeNetMmbtuQuantityTwo());
                        jsonObject13.put("Discharge-2-1", thirdPartyMeasure.getDischargeNetTonsQuantityTwo());
                        jsonObject14.put("Discharge-2-1", thirdPartyMeasure.getDischargeNetMetersQuantityTwo());
                        jsonObject3.put("Discharge-2-1", thirdPartyMeasure.getDischargeCoolMmbtuQuantityTwo());
                        jsonObject15.put("Discharge-2-1", thirdPartyMeasure.getDischargeCoolTonsQuantityTwo());
                        jsonObject16.put("Discharge-2-1", thirdPartyMeasure.getDischargeCoolMetersQuantityTwo());
                        jsonObject4.put("Discharge-2-1", thirdPartyMeasure.getDischargeVapourMmbtuQuantityTwo());
                        jsonObject17.put("Discharge-2-1", thirdPartyMeasure.getDischargeVapourTonsQuantityTwo());
                        jsonObject18.put("Discharge-2-1", thirdPartyMeasure.getDischargeVapourMetersQuantityTwo());
                        jsonObject5.put("Discharge-2-1", thirdPartyMeasure.getDischargeConsumedMmbtuQuantityTwo());
                        jsonObject19.put("Discharge-2-1", thirdPartyMeasure.getDischargeConsumedTonsQuantityTwo());
                        jsonObject20.put("Discharge-2-1", thirdPartyMeasure.getDischargeConsumedMetersQuantityTwo());
                        jsonObject6.put("Discharge-2-1", thirdPartyMeasure.getDischargeGassingMmbtuQuantityTwo());
                        jsonObject21.put("Discharge-2-1", thirdPartyMeasure.getDischargeGassingTonsQuantityTwo());
                        jsonObject22.put("Discharge-2-1", thirdPartyMeasure.getDischargeGassingMetersQuantityTwo());
                        jsonObject7.put("Discharge-2-1", thirdPartyMeasure.getDischargeGhvTwo());
                        jsonObject8.put("Discharge-2-1", thirdPartyMeasure.getDischargeTemperatureTwo());
                        jsonObject9.put("Discharge-2-1", thirdPartyMeasure.getDischargeDensityTwo());
                        jsonObject10.put("Discharge-2-1", thirdPartyMeasure.getDischargeGasTwo());
//                        data.add(jsonObject1);
//                        data.add(jsonObject11);
//                        data.add(jsonObject12);
//                        data.add(jsonObject2);
//                        data.add(jsonObject13);
//                        data.add(jsonObject14);
//                        data.add(jsonObject3);
//                        data.add(jsonObject15);
//                        data.add(jsonObject16);
//                        data.add(jsonObject4);
//                        data.add(jsonObject17);
//                        data.add(jsonObject18);
//                        data.add(jsonObject5);
//                        data.add(jsonObject19);
//                        data.add(jsonObject20);
//                        data.add(jsonObject6);
//                        data.add(jsonObject21);
//                        data.add(jsonObject22);
//                        data.add(jsonObject7);
//                        data.add(jsonObject8);
//                        data.add(jsonObject9);
//                        data.add(jsonObject10);
                        jsonObject1.put("Discharge-2-2", "MMBtu");
                        jsonObject11.put("Discharge-2-2", "Metric Tons");
                        jsonObject12.put("Discharge-2-2", "Cubic Meters");
                        jsonObject2.put("Discharge-2-2", "MMBtu");
                        jsonObject13.put("Discharge-2-2", "Metric Tons");
                        jsonObject14.put("Discharge-2-2", "Cubic Meters");
                        jsonObject3.put("Discharge-2-2", "MMBtu");
                        jsonObject15.put("Discharge-2-2", "Metric Tons");
                        jsonObject16.put("Discharge-2-2", "Cubic Meters");
                        jsonObject4.put("Discharge-2-2", "MMBtu");
                        jsonObject17.put("Discharge-2-2", "Metric Tons");
                        jsonObject18.put("Discharge-2-2", "Cubic Meters");
                        jsonObject5.put("Discharge-2-2", "MMBtu");
                        jsonObject19.put("Discharge-2-2", "Metric Tons");
                        jsonObject20.put("Discharge-2-2", "Cubic Meters");
                        jsonObject6.put("Discharge-2-2", "MMBtu");
                        jsonObject21.put("Discharge-2-2", "Metric Tons");
                        jsonObject22.put("Discharge-2-2", "Cubic Meters");
                        jsonObject7.put("Discharge-2-2", "Btu/scf");
                        jsonObject8.put("Discharge-2-2", "℃");
                        jsonObject9.put("Discharge-2-2", "kg/m³");
                        jsonObject10.put("Discharge-2-2", "m³/MT");
//                        data.add(jsonObject1);
//                        data.add(jsonObject11);
//                        data.add(jsonObject12);
//                        data.add(jsonObject2);
//                        data.add(jsonObject13);
//                        data.add(jsonObject14);
//                        data.add(jsonObject3);
//                        data.add(jsonObject15);
//                        data.add(jsonObject16);
//                        data.add(jsonObject4);
//                        data.add(jsonObject17);
//                        data.add(jsonObject18);
//                        data.add(jsonObject5);
//                        data.add(jsonObject19);
//                        data.add(jsonObject20);
//                        data.add(jsonObject6);
//                        data.add(jsonObject21);
//                        data.add(jsonObject22);
//                        data.add(jsonObject7);
//                        data.add(jsonObject8);
//                        data.add(jsonObject9);
//                        data.add(jsonObject10);
                    }
                    data.add(jsonObject1);
                    data.add(jsonObject11);
                    data.add(jsonObject12);
                    data.add(jsonObject2);
                    data.add(jsonObject13);
                    data.add(jsonObject14);
                    data.add(jsonObject3);
                    data.add(jsonObject15);
                    data.add(jsonObject16);
                    data.add(jsonObject4);
                    data.add(jsonObject17);
                    data.add(jsonObject18);
                    data.add(jsonObject5);
                    data.add(jsonObject19);
                    data.add(jsonObject20);
                    data.add(jsonObject6);
                    data.add(jsonObject21);
                    data.add(jsonObject22);
                    data.add(jsonObject7);
                    data.add(jsonObject8);
                    data.add(jsonObject9);
                    data.add(jsonObject10);
                    thirdPartyMeasureDetailVo.setData(data);
                } else if (i == 3) {
                    //第三个表格内容
                    JSONObject jsonObject1 = new JSONObject();
                    JSONObject jsonObject2 = new JSONObject();
                    JSONObject jsonObject3 = new JSONObject();
                    JSONObject jsonObject4 = new JSONObject();
                    JSONObject jsonObject5 = new JSONObject();
                    JSONObject jsonObject6 = new JSONObject();
                    JSONObject jsonObject7 = new JSONObject();
                    JSONObject jsonObject8 = new JSONObject();
                    JSONObject jsonObject9 = new JSONObject();
                    JSONObject jsonObject10 = new JSONObject();
                    JSONObject jsonObject11 = new JSONObject();

                    jsonObject1.put("firstColumn", "Methane(CH4)");
                    jsonObject2.put("firstColumn", "Ethane(C2H6)");
                    jsonObject3.put("firstColumn", "Propane(C3H8)");
                    jsonObject4.put("firstColumn", "Iso Butane(i-C4H10)");
                    jsonObject5.put("firstColumn", "N-Butane(n-C4H10)");
                    jsonObject6.put("firstColumn", "Iso Pentane(i-C5H12)");
                    jsonObject7.put("firstColumn", "N-Pentane(n-C5H12)");
                    jsonObject8.put("firstColumn", "N-Hexane(n-C6H14)");
                    jsonObject9.put("firstColumn", "Nitrogen(N2)");
                    jsonObject10.put("firstColumn", "Oxygen(O2)");
                    jsonObject11.put("firstColumn", "Carbon Dioxide(CO2)");
//                    data.add(jsonObject1);
//                    data.add(jsonObject2);
//                    data.add(jsonObject3);
//                    data.add(jsonObject4);
//                    data.add(jsonObject5);
//                    data.add(jsonObject6);
//                    data.add(jsonObject7);
//                    data.add(jsonObject8);
//                    data.add(jsonObject9);
//                    data.add(jsonObject10);
//                    data.add(jsonObject11);

                    jsonObject1.put("Loading1", thirdPartyMeasure.getLoadingMethane());
                    jsonObject2.put("Loading1", thirdPartyMeasure.getLoadingEthane());
                    jsonObject3.put("Loading1", thirdPartyMeasure.getLoadingPropane());
                    jsonObject4.put("Loading1", thirdPartyMeasure.getLoadingIbutane());
                    jsonObject5.put("Loading1", thirdPartyMeasure.getLoadingNbutane());
                    jsonObject6.put("Loading1", thirdPartyMeasure.getLoadingIpentane());
                    jsonObject7.put("Loading1", thirdPartyMeasure.getLoadingNpentane());
                    jsonObject8.put("Loading1", thirdPartyMeasure.getLoadingNhexane());
                    jsonObject9.put("Loading1", thirdPartyMeasure.getLoadingNitrogen());
                    jsonObject10.put("Loading1", thirdPartyMeasure.getLoadingOxygen());
                    jsonObject11.put("Loading1", thirdPartyMeasure.getLoadingDioxide());
//                    data.add(jsonObject1);
//                    data.add(jsonObject2);
//                    data.add(jsonObject3);
//                    data.add(jsonObject4);
//                    data.add(jsonObject5);
//                    data.add(jsonObject6);
//                    data.add(jsonObject7);
//                    data.add(jsonObject8);
//                    data.add(jsonObject9);
//                    data.add(jsonObject10);
//                    data.add(jsonObject11);
                    jsonObject1.put("Loading2", "%Mol");
                    jsonObject2.put("Loading2", "%Mol");
                    jsonObject3.put("Loading2", "%Mol");
                    jsonObject4.put("Loading2", "%Mol");
                    jsonObject5.put("Loading2", "%Mol");
                    jsonObject6.put("Loading2", "%Mol");
                    jsonObject7.put("Loading2", "%Mol");
                    jsonObject8.put("Loading2", "%Mol");
                    jsonObject9.put("Loading2", "%Mol");
                    jsonObject10.put("Loading2", "%Mol");
                    jsonObject11.put("Loading2", "%Mol");
//                    data.add(jsonObject1);
//                    data.add(jsonObject2);
//                    data.add(jsonObject3);
//                    data.add(jsonObject4);
//                    data.add(jsonObject5);
//                    data.add(jsonObject6);
//                    data.add(jsonObject7);
//                    data.add(jsonObject8);
//                    data.add(jsonObject9);
//                    data.add(jsonObject10);
//                    data.add(jsonObject11);
                    jsonObject1.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject2.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject3.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject4.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject5.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject6.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject7.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject8.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject9.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject10.put("Remarks", thirdPartyMeasure.getRemarks());
                    jsonObject11.put("Remarks", thirdPartyMeasure.getRemarks());
//                    data.add(jsonObject1);
//                    data.add(jsonObject2);
//                    data.add(jsonObject3);
//                    data.add(jsonObject4);
//                    data.add(jsonObject5);
//                    data.add(jsonObject6);
//                    data.add(jsonObject7);
//                    data.add(jsonObject8);
//                    data.add(jsonObject9);
//                    data.add(jsonObject10);
//                    data.add(jsonObject11);

                    if (thirdPartyMeasure.getVoyageType().equals(3) || thirdPartyMeasure.getVoyageType().equals(4)) {
                        //两装载港
                        jsonObject1.put("Loading-2-1", thirdPartyMeasure.getLoadingMethaneTwo());
                        jsonObject2.put("Loading-2-1", thirdPartyMeasure.getLoadingEthaneTwo());
                        jsonObject3.put("Loading-2-1", thirdPartyMeasure.getLoadingPropaneTwo());
                        jsonObject4.put("Loading-2-1", thirdPartyMeasure.getLoadingIbutaneTwo());
                        jsonObject5.put("Loading-2-1", thirdPartyMeasure.getLoadingNbutaneTwo());
                        jsonObject6.put("Loading-2-1", thirdPartyMeasure.getLoadingIpentaneTwo());
                        jsonObject7.put("Loading-2-1", thirdPartyMeasure.getLoadingNpentaneTwo());
                        jsonObject8.put("Loading-2-1", thirdPartyMeasure.getLoadingNhexaneTwo());
                        jsonObject9.put("Loading-2-1", thirdPartyMeasure.getLoadingNitrogenTwo());
                        jsonObject10.put("Loading-2-1", thirdPartyMeasure.getLoadingOxygenTwo());
                        jsonObject11.put("Loading-2-1", thirdPartyMeasure.getLoadingDioxideTwo());
//                        data.add(jsonObject1);
//                        data.add(jsonObject2);
//                        data.add(jsonObject3);
//                        data.add(jsonObject4);
//                        data.add(jsonObject5);
//                        data.add(jsonObject6);
//                        data.add(jsonObject7);
//                        data.add(jsonObject8);
//                        data.add(jsonObject9);
//                        data.add(jsonObject10);
//                        data.add(jsonObject11);

                        jsonObject1.put("Loading-2-2", "%Mol");
                        jsonObject2.put("Loading-2-2", "%Mol");
                        jsonObject3.put("Loading-2-2", "%Mol");
                        jsonObject4.put("Loading-2-2", "%Mol");
                        jsonObject5.put("Loading-2-2", "%Mol");
                        jsonObject6.put("Loading-2-2", "%Mol");
                        jsonObject7.put("Loading-2-2", "%Mol");
                        jsonObject8.put("Loading-2-2", "%Mol");
                        jsonObject9.put("Loading-2-2", "%Mol");
                        jsonObject10.put("Loading-2-2", "%Mol");
                        jsonObject11.put("Loading-2-2", "%Mol");
//                        data.add(jsonObject1);
//                        data.add(jsonObject2);
//                        data.add(jsonObject3);
//                        data.add(jsonObject4);
//                        data.add(jsonObject5);
//                        data.add(jsonObject6);
//                        data.add(jsonObject7);
//                        data.add(jsonObject8);
//                        data.add(jsonObject9);
//                        data.add(jsonObject10);
//                        data.add(jsonObject11);
                    }
                    if (thirdPartyMeasure.getVoyageType().equals(1) || thirdPartyMeasure.getVoyageType().equals(3)) {
                        //一卸载
                        jsonObject1.put("Discharge1", thirdPartyMeasure.getDischargeMethane());
                        jsonObject2.put("Discharge1", thirdPartyMeasure.getDischargeEthane());
                        jsonObject3.put("Discharge1", thirdPartyMeasure.getDischargePropane());
                        jsonObject4.put("Discharge1", thirdPartyMeasure.getDischargeIbutane());
                        jsonObject5.put("Discharge1", thirdPartyMeasure.getDischargeNbutane());
                        jsonObject6.put("Discharge1", thirdPartyMeasure.getDischargeIpentane());
                        jsonObject7.put("Discharge1", thirdPartyMeasure.getDischargeNpentane());
                        jsonObject8.put("Discharge1", thirdPartyMeasure.getDischargeNhexane());
                        jsonObject9.put("Discharge1", thirdPartyMeasure.getDischargeNitrogen());
                        jsonObject10.put("Discharge1", thirdPartyMeasure.getDischargeOxygen());
                        jsonObject11.put("Discharge1", thirdPartyMeasure.getDischargeDioxide());
//                        data.add(jsonObject1);
//                        data.add(jsonObject2);
//                        data.add(jsonObject3);
//                        data.add(jsonObject4);
//                        data.add(jsonObject5);
//                        data.add(jsonObject6);
//                        data.add(jsonObject7);
//                        data.add(jsonObject8);
//                        data.add(jsonObject9);
//                        data.add(jsonObject10);
//                        data.add(jsonObject11);

                        jsonObject1.put("Discharge2", "%Mol");
                        jsonObject2.put("Discharge2", "%Mol");
                        jsonObject3.put("Discharge2", "%Mol");
                        jsonObject4.put("Discharge2", "%Mol");
                        jsonObject5.put("Discharge2", "%Mol");
                        jsonObject6.put("Discharge2", "%Mol");
                        jsonObject7.put("Discharge2", "%Mol");
                        jsonObject8.put("Discharge2", "%Mol");
                        jsonObject9.put("Discharge2", "%Mol");
                        jsonObject10.put("Discharge2", "%Mol");
                        jsonObject11.put("Discharge2", "%Mol");
//                        data.add(jsonObject1);
//                        data.add(jsonObject2);
//                        data.add(jsonObject3);
//                        data.add(jsonObject4);
//                        data.add(jsonObject5);
//                        data.add(jsonObject6);
//                        data.add(jsonObject7);
//                        data.add(jsonObject8);
//                        data.add(jsonObject9);
//                        data.add(jsonObject10);
//                        data.add(jsonObject11);
                    } else if (thirdPartyMeasure.getVoyageType().equals(2) || thirdPartyMeasure.getVoyageType().equals(4)) {
                        //两卸载
                        jsonObject1.put("Discharge-2-1", thirdPartyMeasure.getDischargeMethaneTwo());
                        jsonObject2.put("Discharge-2-1", thirdPartyMeasure.getDischargeEthaneTwo());
                        jsonObject3.put("Discharge-2-1", thirdPartyMeasure.getDischargePropaneTwo());
                        jsonObject4.put("Discharge-2-1", thirdPartyMeasure.getDischargeIbutaneTwo());
                        jsonObject5.put("Discharge-2-1", thirdPartyMeasure.getDischargeNbutaneTwo());
                        jsonObject6.put("Discharge-2-1", thirdPartyMeasure.getDischargeIpentaneTwo());
                        jsonObject7.put("Discharge-2-1", thirdPartyMeasure.getDischargeNpentaneTwo());
                        jsonObject8.put("Discharge-2-1", thirdPartyMeasure.getDischargeNhexaneTwo());
                        jsonObject9.put("Discharge-2-1", thirdPartyMeasure.getDischargeNitrogenTwo());
                        jsonObject10.put("Discharge-2-1", thirdPartyMeasure.getDischargeOxygenTwo());
                        jsonObject11.put("Discharge-2-1", thirdPartyMeasure.getDischargeDioxideTwo());
//                        data.add(jsonObject1);
//                        data.add(jsonObject2);
//                        data.add(jsonObject3);
//                        data.add(jsonObject4);
//                        data.add(jsonObject5);
//                        data.add(jsonObject6);
//                        data.add(jsonObject7);
//                        data.add(jsonObject8);
//                        data.add(jsonObject9);
//                        data.add(jsonObject10);
//                        data.add(jsonObject11);
                        jsonObject1.put("Discharge-2-2", "%Mol");
                        jsonObject2.put("Discharge-2-2", "%Mol");
                        jsonObject3.put("Discharge-2-2", "%Mol");
                        jsonObject4.put("Discharge-2-2", "%Mol");
                        jsonObject5.put("Discharge-2-2", "%Mol");
                        jsonObject6.put("Discharge-2-2", "%Mol");
                        jsonObject7.put("Discharge-2-2", "%Mol");
                        jsonObject8.put("Discharge-2-2", "%Mol");
                        jsonObject9.put("Discharge-2-2", "%Mol");
                        jsonObject10.put("Discharge-2-2", "%Mol");
                        jsonObject11.put("Discharge-2-2", "%Mol");
//                        data.add(jsonObject1);
//                        data.add(jsonObject2);
//                        data.add(jsonObject3);
//                        data.add(jsonObject4);
//                        data.add(jsonObject5);
//                        data.add(jsonObject6);
//                        data.add(jsonObject7);
//                        data.add(jsonObject8);
//                        data.add(jsonObject9);
//                        data.add(jsonObject10);
//                        data.add(jsonObject11);
                    }
                    data.add(jsonObject1);
                    data.add(jsonObject2);
                    data.add(jsonObject3);
                    data.add(jsonObject4);
                    data.add(jsonObject5);
                    data.add(jsonObject6);
                    data.add(jsonObject7);
                    data.add(jsonObject8);
                    data.add(jsonObject9);
                    data.add(jsonObject10);
                    data.add(jsonObject11);
                    thirdPartyMeasureDetailVo.setData(data);
                } else if (i == 4) {
                    //第四个表格内容
                    List<SmThirdPartyMeasureRecord> thirdPartyMeasureRecords = thirdPartyMeasureRecordMapper.selectList(new LambdaQueryWrapper<SmThirdPartyMeasureRecord>()
                            .eq(SmThirdPartyMeasureRecord::getThirdPartyMeasureId, thirdPartyMeasure.getId())
                            .eq(SmThirdPartyMeasureRecord::getRecordType, 1));
                    if (null != thirdPartyMeasureRecords && thirdPartyMeasureRecords.size() > 0) {
                        //SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
                        thirdPartyMeasureRecords.stream().forEach(t -> {
                            JSONObject jsonObject = new JSONObject();
                            //jsonObject.put("firstColumn", dateFormat.format(t.getRecordTime()));
                            jsonObject.put("firstColumn", t.getRecordTime());
                            //data.add(jsonObject);
                            jsonObject.put("Loading1", t.getRecordContent());
                            //data.add(jsonObject);
                            jsonObject.put("Remarks", thirdPartyMeasure.getRemarks());
                            data.add(jsonObject);
                            thirdPartyMeasureDetailVo.setData(data);
                        });
                    }
                } else if (i == 5) {
                    //第五个表格内容
                    List<SmThirdPartyMeasureRecord> thirdPartyMeasureRecords = thirdPartyMeasureRecordMapper.selectList(new LambdaQueryWrapper<SmThirdPartyMeasureRecord>()
                            .eq(SmThirdPartyMeasureRecord::getThirdPartyMeasureId, thirdPartyMeasure.getId())
                            .eq(SmThirdPartyMeasureRecord::getRecordType, 2));
                    if (null != thirdPartyMeasureRecords && thirdPartyMeasureRecords.size() > 0) {
                        //SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
                        thirdPartyMeasureRecords.stream().forEach(t -> {
                            JSONObject jsonObject = new JSONObject();
                            //jsonObject.put("firstColumn", dateFormat.format(t.getRecordTime()));
                            jsonObject.put("firstColumn", t.getRecordTime());
                            //data.add(jsonObject);
                            jsonObject.put("Loading1", t.getRecordContent());
                            //data.add(jsonObject);
                            jsonObject.put("Remarks", thirdPartyMeasure.getRemarks());
                            data.add(jsonObject);
                            thirdPartyMeasureDetailVo.setData(data);
                        });
                    }
                }
                detailVos.add(thirdPartyMeasureDetailVo);
            }
            //构建附件集合
            if (null != fileRecords && fileRecords.size() > 0) {
                fileRecords.stream().forEach(f -> {
                    ThirdPartyMeasureDetailFileVo fileVo = new ThirdPartyMeasureDetailFileVo();
                    BeanUtils.copyProperties(f, fileVo);
                    fileVo.setId(f.getId().toString());
                    file.add(fileVo);
                });
            }
            thirdPartyMeasureDetailAllVo.setRemarkContent(thirdPartyMeasure.getRemarkContent());
            thirdPartyMeasureDetailAllVo.setDetailVos(detailVos);
            thirdPartyMeasureDetailAllVo.setFile(file);
        }
        return thirdPartyMeasureDetailAllVo;
    }

    /**
     * 文本替换
     *
     * @param workbook
     * @param oldText
     * @param newText
     */
    public void replaceCostText(Workbook workbook, String oldText, String newText) {
        for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
            Sheet sheet = workbook.getSheetAt(i);
            for (Row row : sheet) {
                for (Cell cell : row) {
                    if (cell.getCellType() == CellType.STRING && cell.getStringCellValue().equals(oldText)) {
                        cell.setCellValue(newText);
                    }
                }
            }
        }
    }

    /**
     * 创建标题样式
     *
     * @param wb
     * @return
     */
    private static XSSFCellStyle createTitleCellStyle(XSSFWorkbook wb) {
        XSSFCellStyle cellStyle = wb.createCellStyle();
        cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直对齐
        cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        cellStyle.setFillForegroundColor(new XSSFColor(new java.awt.Color(220, 230, 241)));//背景颜色

        XSSFFont headerFont1 = (XSSFFont) wb.createFont(); // 创建字体样式
        headerFont1.setBold(false); //字体加粗
        headerFont1.setFontName("Times New Roman"); // 设置字体类型
        headerFont1.setFontHeightInPoints((short) 12); // 设置字体大小
        cellStyle.setFont(headerFont1); // 为标题样式设置字体样式
        return cellStyle;
    }

    /**
     * 船务管理-第三方计量详情导出
     *
     * @param id
     * @return
     */
    @Override
    public JsonResult exportThirdPartyMeasureDetail(String templateUrl, Long id, List<SpFobFileRecord> fileRecords, String fileServerHost) {
        JsonResult jsonResult = new JsonResult();
        List<File> downloadFiles = new LinkedList<>();
        try {
            //获取运费模板
            URL url = new URL(templateUrl);
            InputStream inputStream = url.openStream();
            Workbook workbook = new XSSFWorkbook(inputStream);

            //创建临时压缩文件
            File zipFile = new File("第三方计量报告" + System.currentTimeMillis() + ".zip");

            List<ThirdPartyMeasureDetailBo> detailBos = this.getThirdPartyMeasureExportDetail(id);
            //替换内容
            for (ThirdPartyMeasureDetailBo data : detailBos) {
                replaceCostText(workbook, data.getName(), data.getValue());
            }

            //动态插入Log
            for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
                Sheet sheet = workbook.getSheetAt(i);
                XSSFRow sourceRow = (XSSFRow) sheet.getRow(42);
                for (Row row : sheet) {
                    for (Cell cell : row) {
                        if (cell.getCellType() == CellType.STRING && cell.getStringCellValue().equals("Loading Time Log")) {
                            List<SmThirdPartyMeasureRecord> thirdPartyMeasureRecords = thirdPartyMeasureRecordMapper.selectList(new LambdaQueryWrapper<SmThirdPartyMeasureRecord>()
                                    .eq(SmThirdPartyMeasureRecord::getThirdPartyMeasureId, id)
                                    .eq(SmThirdPartyMeasureRecord::getRecordType, 1));
                            //SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
                            int j = 1;
                            int n = 0;
                            for (SmThirdPartyMeasureRecord record : thirdPartyMeasureRecords) {
                                Row newRow = sheet.createRow(row.getRowNum() + j);
                                Cell cell0 = newRow.createCell(0);
                                cell0.setCellValue(record.getRecordTime());
                                Cell cell1 = newRow.createCell(1);
                                cell1.setCellValue(record.getRecordContent());
                                j++;
                                n = row.getRowNum() + j;
                            }
                            //设置Discharge Time Log标题
                            if (n == 0) {
                                n = row.getRowNum() + 1;
                            }
                            sheet.addMergedRegion(new CellRangeAddress(n, n, 0, 9));
                            XSSFCellStyle titleStyle = createTitleCellStyle((XSSFWorkbook) workbook);
                            Row newRow = sheet.createRow(n);
                            Cell cell0 = newRow.createCell(0);
                            cell0.setCellValue("Discharge Time Log");
                            cell0.setCellStyle(titleStyle);
                            //设置Discharge Time Log内容
                            List<SmThirdPartyMeasureRecord> thirdPartyMeasureDischarRecords = thirdPartyMeasureRecordMapper.selectList(new LambdaQueryWrapper<SmThirdPartyMeasureRecord>()
                                    .eq(SmThirdPartyMeasureRecord::getThirdPartyMeasureId, id)
                                    .eq(SmThirdPartyMeasureRecord::getRecordType, 2));
                            for (SmThirdPartyMeasureRecord record : thirdPartyMeasureDischarRecords) {
                                Row newDischargeRow = sheet.createRow(n + 1);
                                Cell cellDischarge0 = newDischargeRow.createCell(0);
                                //cellDischarge0.setCellValue(dateFormat.format(record.getRecordTime()));
                                cellDischarge0.setCellValue(record.getRecordTime());
                                Cell cell1 = newDischargeRow.createCell(1);
                                cell1.setCellValue(record.getRecordContent());
                            }
                            //设置备注内容
                            XSSFCellStyle cellStyle = (XSSFCellStyle) workbook.createCellStyle();
                            XSSFFont headerFont1 = (XSSFFont) workbook.createFont(); // 创建字体样式
                            headerFont1.setBold(false); //字体加粗
                            headerFont1.setFontName("Times New Roman"); // 设置字体类型
                            headerFont1.setFontHeightInPoints((short) 12); // 设置字体大小
                            cellStyle.setFont(headerFont1); // 为标题样式设置字体样式

                            Row newRemarkRow = sheet.createRow(n + 3);
                            Cell cellRemark0 = newRemarkRow.createCell(0);
                            cellRemark0.setCellValue("备注内容");
                            cellRemark0.setCellStyle(cellStyle);
                            SmThirdPartyMeasure thirdPartyMeasure = this.getBaseMapper().selectById(id);
                            Cell cellRemark1 = newRemarkRow.createCell(1);
                            if (null != thirdPartyMeasure) {
                                cellRemark1.setCellValue(thirdPartyMeasure.getRemarkContent());
                            } else {
                                cellRemark1.setCellValue("");
                            }
                        }
                        break;
                    }
                }
            }
            if (null != fileRecords && fileRecords.size() > 0) {
                for (SpFobFileRecord f : fileRecords) {
                    //文件下载进压缩包
                    String fileUrl = f.getPath();

                    URL otherUrl = new URL(fileUrl);
                    InputStream otherInputStream = otherUrl.openStream();
                    String[] nameArr = f.getName().split("\\.");
                    File tempFile = File.createTempFile(nameArr[0], "." + nameArr[1]);
                    try (FileOutputStream fileOutputStream = new FileOutputStream(tempFile)) {
                        byte[] buffer = new byte[1024];
                        int bytesRead;
                        while ((bytesRead = otherInputStream.read(buffer)) != -1) {
                            fileOutputStream.write(buffer, 0, bytesRead);
                        }
                    }
                    downloadFiles.add(tempFile);
                }
            }

            File tempFile = File.createTempFile("第三方计量报告明细", ".xlsx");
            //创建输出流
            FileOutputStream fileOutputStream = new FileOutputStream(tempFile);
            workbook.write(fileOutputStream);
            fileOutputStream.close();
            downloadFiles.add(tempFile);
            try (FileOutputStream fos = new FileOutputStream(zipFile);
                 ZipOutputStream zos = new ZipOutputStream(fos)) {
                for (File downloadFile : downloadFiles) {
                    ZipEntry zipEntry = new ZipEntry(downloadFile.getName());
                    zos.putNextEntry(zipEntry);
                    try (FileInputStream fis = new FileInputStream(downloadFile)) {
                        byte[] buffer = new byte[1024];
                        int length;
                        while ((length = fis.read(buffer)) > 0) {
                            zos.write(buffer, 0, length);
                        }
                    }
                    zos.closeEntry();
                    downloadFile.delete();
                }
            }
//            HashMap<String, Object> paramMap = new HashMap<>();
//            //文件
//            paramMap.put("file", zipFile);
//            //输出
//            paramMap.put("output", "json");
//            //自定义路径
//            paramMap.put("path", "zip");
//            //场景
//            paramMap.put("scene", "zip");
//
//            paramMap.put("filename", zipFile.getName());
            //上传
//            String result = HttpUtil.post(fileServerHost + "/group1/upload", paramMap);
//            Gson gson = new Gson();
//            JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
            FileInputStream input = new FileInputStream(zipFile);
            MultipartFile multipartFile = new MockMultipartFile("file", zipFile.getName(), "application/octet-stream", input);
            R<SysFile> result1 = remoteFileService.upload(multipartFile);
            if(result1.getCode() != R.SUCCESS){
                throw new BusException("文件服务器连接失败", BaseResultCode.GENERAL_ERROR);
            }
            String urld = result1.getData().getHttpsUrl();
            zipFile.delete();
            return JsonResult.success(urld);
        } catch (Exception e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
            return JsonResult.failed("文件解析异常！");
        }
    }

    public List<ThirdPartyMeasureDetailBo> getThirdPartyMeasureExportDetail(Long id) {
        SmThirdPartyMeasure thirdPartyMeasure = this.getBaseMapper().selectById(id);
        List<ThirdPartyMeasureDetailBo> thirdPartyMeasureDetailBos = new ArrayList<>();
        if (null != thirdPartyMeasure) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Port-a2", thirdPartyMeasure.getLoadingPort()));
            if (null != thirdPartyMeasure.getLoadingStartDate()) {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Start Date-a2", dateFormat.format(thirdPartyMeasure.getLoadingStartDate())));
            } else {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Start Date-a2", ""));
            }
            if (null != thirdPartyMeasure.getLoadingEndDate()) {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-End Date-a2", dateFormat.format(thirdPartyMeasure.getLoadingEndDate())));
            } else {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-End Date-a2", ""));
            }
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Independent-a2", thirdPartyMeasure.getLoadingIndependent()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Port-a4", thirdPartyMeasure.getLoadingPortTwo()));
            if (null != thirdPartyMeasure.getLoadingStartDateTwo()) {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Start Date-a4", dateFormat.format(thirdPartyMeasure.getLoadingStartDateTwo())));
            } else {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Start Date-a4", ""));
            }
            if (null != thirdPartyMeasure.getLoadingEndDateTwo()) {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-End Date-a4", dateFormat.format(thirdPartyMeasure.getLoadingEndDateTwo())));
            } else {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-End Date-a4", ""));
            }
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Independent-a4", thirdPartyMeasure.getLoadingIndependentTwo()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Port-a6", thirdPartyMeasure.getDischargePort()));
            if (null != thirdPartyMeasure.getDischargeStartDate()) {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Start Date-a6", dateFormat.format(thirdPartyMeasure.getDischargeStartDate())));
            } else {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Start Date-a6", ""));
            }
            if (null != thirdPartyMeasure.getDischargeEndDate()) {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-End Date-a6", dateFormat.format(thirdPartyMeasure.getDischargeEndDate())));
            } else {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-End Date-a6", ""));
            }
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Independent-a6", thirdPartyMeasure.getDischargeIndependent()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Port-a8", thirdPartyMeasure.getDischargePortTwo()));
            if (null != thirdPartyMeasure.getDischargeStartDateTwo()) {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Start Date-a8", dateFormat.format(thirdPartyMeasure.getDischargeStartDateTwo())));
            } else {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Start Date-a8", ""));
            }
            if (null != thirdPartyMeasure.getDischargeEndDateTwo()) {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-End Date-a8", dateFormat.format(thirdPartyMeasure.getDischargeEndDateTwo())));
            } else {
                thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-End Date-a8", ""));
            }
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Independent-a8", thirdPartyMeasure.getDischargeIndependentTwo()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Port-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Start Date-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-End Date-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Independent-a10", thirdPartyMeasure.getRemarks()));
            //第二个表格
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Gross Quantity-MMBtu-a2", thirdPartyMeasure.getLoadingGrossMmbtuQuantity() == null ? "" : thirdPartyMeasure.getLoadingGrossMmbtuQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Gross Quantity-Metric Tons-a2", thirdPartyMeasure.getLoadingGrossTonsQuantity() == null ? "" : thirdPartyMeasure.getLoadingGrossTonsQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Gross Quantity-Cubic Meters-a2", thirdPartyMeasure.getLoadingGrossMetersQuantity() == null ? "" : thirdPartyMeasure.getLoadingGrossMetersQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Net Quantity-MMBtu-a2", thirdPartyMeasure.getLoadingNetMmbtuQuantity() == null ? "" : thirdPartyMeasure.getLoadingNetMmbtuQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Net Quantity-Metric Tons-a2", thirdPartyMeasure.getLoadingNetTonsQuantity() == null ? "" : thirdPartyMeasure.getLoadingNetTonsQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Net Quantity-Cubic Meters-a2", thirdPartyMeasure.getLoadingNetMetersQuantity() == null ? "" : thirdPartyMeasure.getLoadingNetMetersQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-COOL DOWN-MMBtu-a2", thirdPartyMeasure.getLoadingCoolMmbtuQuantity() == null ? "" : thirdPartyMeasure.getLoadingCoolMmbtuQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-COOL DOWN-Metric Tons-a2", thirdPartyMeasure.getLoadingCoolTonsQuantity() == null ? "" : thirdPartyMeasure.getLoadingCoolTonsQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-COOL DOWN-Cubic Meters-a2", thirdPartyMeasure.getLoadingCoolMetersQuantity() == null ? "" : thirdPartyMeasure.getLoadingCoolMetersQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-VAPOUR-MMBtu-a2", thirdPartyMeasure.getLoadingVapourMmbtuQuantity() == null ? "" : thirdPartyMeasure.getLoadingVapourMmbtuQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-VAPOUR-Metric Tons-a2", thirdPartyMeasure.getLoadingVapourTonsQuantity() == null ? "" : thirdPartyMeasure.getLoadingVapourTonsQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-VAPOUR-Cubic Meters-a2", thirdPartyMeasure.getLoadingVapourMetersQuantity() == null ? "" : thirdPartyMeasure.getLoadingVapourMetersQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-BOG CONSUMED-MMBtu-a2", thirdPartyMeasure.getLoadingConsumedMmbtuQuantity() == null ? "" : thirdPartyMeasure.getLoadingConsumedMmbtuQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-BOG CONSUMED-Metric Tons-a2", thirdPartyMeasure.getLoadingConsumedTonsQuantity() == null ? "" : thirdPartyMeasure.getLoadingConsumedTonsQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-BOG CONSUMED-Cubic Meters-a2", thirdPartyMeasure.getLoadingConsumedMetersQuantity() == null ? "" : thirdPartyMeasure.getLoadingConsumedMetersQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-GASSING UP-MMBtu-a2", thirdPartyMeasure.getLoadingGassingMmbtuQuantity() == null ? "" : thirdPartyMeasure.getLoadingGassingMmbtuQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-GASSING UP-Metric Tons-a2", thirdPartyMeasure.getLoadingGassingTonsQuantity() == null ? "" : thirdPartyMeasure.getLoadingGassingTonsQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-GASSING UP-Cubic Meters-a2", thirdPartyMeasure.getLoadingGassingMetersQuantity() == null ? "" : thirdPartyMeasure.getLoadingGassingMetersQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-GHV-a2", thirdPartyMeasure.getLoadingGhv() == null ? "" : thirdPartyMeasure.getLoadingGhv().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Temperature-a2", thirdPartyMeasure.getLoadingTemperature() == null ? "" : thirdPartyMeasure.getLoadingTemperature().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Density-a2", thirdPartyMeasure.getLoadingDensity() == null ? "" : thirdPartyMeasure.getLoadingDensity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-气化率-a2", thirdPartyMeasure.getLoadingGas() == null ? "" : thirdPartyMeasure.getLoadingGas().toString()));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Gross Quantity-MMBtu-a4", thirdPartyMeasure.getLoadingGrossMmbtuQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingGrossMmbtuQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Gross Quantity-Metric Tons-a4", thirdPartyMeasure.getLoadingGrossTonsQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingGrossTonsQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Gross Quantity-Cubic Meters-a4", thirdPartyMeasure.getLoadingGrossMetersQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingGrossMetersQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Net Quantity-MMBtu-a4", thirdPartyMeasure.getLoadingNetMmbtuQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingNetMmbtuQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Net Quantity-Metric Tons-a4", thirdPartyMeasure.getLoadingNetTonsQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingNetTonsQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Net Quantity-Cubic Meters-a4", thirdPartyMeasure.getLoadingNetMetersQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingNetMetersQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-COOL DOWN-MMBtu-a4", thirdPartyMeasure.getLoadingCoolMmbtuQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingCoolMmbtuQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-COOL DOWN-Metric Tons-a4", thirdPartyMeasure.getLoadingCoolTonsQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingCoolTonsQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-COOL DOWN-Cubic Meters-a4", thirdPartyMeasure.getLoadingCoolMetersQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingCoolMetersQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-VAPOUR-MMBtu-a4", thirdPartyMeasure.getLoadingVapourMmbtuQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingVapourMmbtuQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-VAPOUR-Metric Tons-a4", thirdPartyMeasure.getLoadingVapourTonsQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingVapourTonsQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-VAPOUR-Cubic Meters-a4", thirdPartyMeasure.getLoadingVapourMetersQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingVapourMetersQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-BOG CONSUMED-MMBtu-a4", thirdPartyMeasure.getLoadingConsumedMmbtuQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingConsumedMmbtuQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-BOG CONSUMED-Metric Tons-a4", thirdPartyMeasure.getLoadingConsumedTonsQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingConsumedTonsQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-BOG CONSUMED-Cubic Meters-a4", thirdPartyMeasure.getLoadingConsumedMetersQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingConsumedMetersQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-GASSING UP-MMBtu-a4", thirdPartyMeasure.getLoadingGassingMmbtuQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingGassingMmbtuQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-GASSING UP-Metric Tons-a4", thirdPartyMeasure.getLoadingGassingTonsQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingGassingTonsQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-GASSING UP-Cubic Meters-a4", thirdPartyMeasure.getLoadingGassingMetersQuantityTwo() == null ? "" : thirdPartyMeasure.getLoadingGassingMetersQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-GHV-a4", thirdPartyMeasure.getLoadingGhvTwo() == null ? "" : thirdPartyMeasure.getLoadingGhvTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Temperature-a4", thirdPartyMeasure.getLoadingTemperatureTwo() == null ? "" : thirdPartyMeasure.getLoadingTemperatureTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Density-a4", thirdPartyMeasure.getLoadingDensityTwo() == null ? "" : thirdPartyMeasure.getLoadingDensityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-气化率-a4", thirdPartyMeasure.getLoadingGasTwo() == null ? "" : thirdPartyMeasure.getLoadingGasTwo().toString()));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Gross Quantity-MMBtu-a6", thirdPartyMeasure.getDischargeGrossMmbtuQuantity() == null ? "" : thirdPartyMeasure.getDischargeGrossMmbtuQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Gross Quantity-Metric Tons-a6", thirdPartyMeasure.getDischargeGrossTonsQuantity() == null ? "" : thirdPartyMeasure.getDischargeGrossTonsQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Gross Quantity-Cubic Meters-a6", thirdPartyMeasure.getDischargeGrossMetersQuantity() == null ? "" : thirdPartyMeasure.getDischargeGrossMetersQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Net Quantity-MMBtu-a6", thirdPartyMeasure.getDischargeNetMmbtuQuantity() == null ? "" : thirdPartyMeasure.getDischargeNetMmbtuQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Net Quantity-Metric Tons-a6", thirdPartyMeasure.getDischargeNetTonsQuantity() == null ? "" : thirdPartyMeasure.getDischargeNetTonsQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Net Quantity-Cubic Meters-a6", thirdPartyMeasure.getDischargeNetMetersQuantity() == null ? "" : thirdPartyMeasure.getDischargeNetMetersQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-COOL DOWN-MMBtu-a6", thirdPartyMeasure.getDischargeCoolMmbtuQuantity() == null ? "" : thirdPartyMeasure.getDischargeCoolMmbtuQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-COOL DOWN-Metric Tons-a6", thirdPartyMeasure.getDischargeCoolTonsQuantity() == null ? "" : thirdPartyMeasure.getDischargeCoolTonsQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-COOL DOWN-Cubic Meters-a6", thirdPartyMeasure.getDischargeCoolMetersQuantity() == null ? "" : thirdPartyMeasure.getDischargeCoolMetersQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-VAPOUR-MMBtu-a6", thirdPartyMeasure.getDischargeVapourMmbtuQuantity() == null ? "" : thirdPartyMeasure.getDischargeVapourMmbtuQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-VAPOUR-Metric Tons-a6", thirdPartyMeasure.getDischargeVapourTonsQuantity() == null ? "" : thirdPartyMeasure.getDischargeVapourTonsQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-VAPOUR-Cubic Meters-a6", thirdPartyMeasure.getDischargeVapourMetersQuantity() == null ? "" : thirdPartyMeasure.getDischargeVapourMetersQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-BOG CONSUMED-MMBtu-a6", thirdPartyMeasure.getDischargeConsumedMmbtuQuantity() == null ? "" : thirdPartyMeasure.getDischargeConsumedMmbtuQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-BOG CONSUMED-Metric Tons-a6", thirdPartyMeasure.getDischargeConsumedTonsQuantity() == null ? "" : thirdPartyMeasure.getDischargeConsumedTonsQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-BOG CONSUMED-Cubic Meters-a6", thirdPartyMeasure.getDischargeConsumedMetersQuantity() == null ? "" : thirdPartyMeasure.getDischargeConsumedMetersQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-GASSING UP-MMBtu-a6", thirdPartyMeasure.getDischargeGassingMmbtuQuantity() == null ? "" : thirdPartyMeasure.getDischargeGassingMmbtuQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-GASSING UP-Metric Tons-a6", thirdPartyMeasure.getDischargeGassingTonsQuantity() == null ? "" : thirdPartyMeasure.getDischargeGassingTonsQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-GASSING UP-Cubic Meters-a6", thirdPartyMeasure.getDischargeGassingMetersQuantity() == null ? "" : thirdPartyMeasure.getDischargeGassingMetersQuantity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-GHV-a6", thirdPartyMeasure.getDischargeGhv() == null ? "" : thirdPartyMeasure.getDischargeGhv().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Temperature-a6", thirdPartyMeasure.getDischargeTemperature() == null ? "" : thirdPartyMeasure.getDischargeTemperature().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Density-a6", thirdPartyMeasure.getDischargeDensity() == null ? "" : thirdPartyMeasure.getDischargeDensity().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-气化率-a6", thirdPartyMeasure.getDischargeGas() == null ? "" : thirdPartyMeasure.getDischargeGas().toString()));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Gross Quantity-MMBtu-a8", thirdPartyMeasure.getDischargeGrossMmbtuQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeGrossMmbtuQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Gross Quantity-Metric Tons-a8", thirdPartyMeasure.getDischargeGrossTonsQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeGrossTonsQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Gross Quantity-Cubic Meters-a8", thirdPartyMeasure.getDischargeGrossMetersQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeGrossMetersQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Net Quantity-MMBtu-a8", thirdPartyMeasure.getDischargeNetMmbtuQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeNetMmbtuQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Net Quantity-Metric Tons-a8", thirdPartyMeasure.getDischargeNetTonsQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeNetTonsQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Net Quantity-Cubic Meters-a8", thirdPartyMeasure.getDischargeNetMetersQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeNetMetersQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-COOL DOWN-MMBtu-a8", thirdPartyMeasure.getDischargeCoolMmbtuQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeCoolMmbtuQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-COOL DOWN-Metric Tons-a8", thirdPartyMeasure.getDischargeCoolTonsQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeCoolTonsQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-COOL DOWN-Cubic Meters-a8", thirdPartyMeasure.getDischargeCoolMetersQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeCoolMetersQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-VAPOUR-MMBtu-a8", thirdPartyMeasure.getDischargeVapourMmbtuQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeVapourMmbtuQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-VAPOUR-Metric Tons-a8", thirdPartyMeasure.getDischargeVapourTonsQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeVapourTonsQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-VAPOUR-Cubic Meters-a8", thirdPartyMeasure.getDischargeVapourMetersQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeVapourMetersQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-BOG CONSUMED-MMBtu-a8", thirdPartyMeasure.getDischargeConsumedMmbtuQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeConsumedMmbtuQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-BOG CONSUMED-Metric Tons-a8", thirdPartyMeasure.getDischargeConsumedTonsQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeConsumedTonsQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-BOG CONSUMED-Cubic Meters-a8", thirdPartyMeasure.getDischargeConsumedMetersQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeConsumedMetersQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-GASSING UP-MMBtu-a8", thirdPartyMeasure.getDischargeGassingMmbtuQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeGassingMmbtuQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-GASSING UP-Metric Tons-a8", thirdPartyMeasure.getDischargeGassingTonsQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeGassingTonsQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-GASSING UP-Cubic Meters-a8", thirdPartyMeasure.getDischargeGassingMetersQuantityTwo() == null ? "" : thirdPartyMeasure.getDischargeGassingMetersQuantityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-GHV-a8", thirdPartyMeasure.getDischargeGhvTwo() == null ? "" : thirdPartyMeasure.getDischargeGhvTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Temperature-a8", thirdPartyMeasure.getDischargeTemperatureTwo() == null ? "" : thirdPartyMeasure.getDischargeTemperatureTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Density-a8", thirdPartyMeasure.getDischargeDensityTwo() == null ? "" : thirdPartyMeasure.getDischargeDensityTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-气化率-a8", thirdPartyMeasure.getDischargeGasTwo() == null ? "" : thirdPartyMeasure.getDischargeGasTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Gross Quantity-MMBtu-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Gross Quantity-Tons-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Gross Quantity-Meters-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Net Quantity-MMBtu-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Net Quantity-Tons-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Net Quantity-Meters-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-COOL DOWN-MMBtu-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-COOL DOWN-Tons-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-COOL DOWN-Meters-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-VAPOUR-MMBtu-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-VAPOUR-Tons-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-VAPOUR-Meters-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-BOG CONSUMED-MMBtu-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-BOG CONSUMED-Tons-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-BOG CONSUMED-Meters-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-GASSING UP-MMBtu-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-GASSING UP-Tons-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-GASSING UP-Meters-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-GHV-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Temperature-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Density-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-气化率-a10", thirdPartyMeasure.getRemarks()));
            //第三个表格
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Methane(CH4)-a2", thirdPartyMeasure.getLoadingMethane() == null ? "" : thirdPartyMeasure.getLoadingMethane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Ethane(C2H6)-a2", thirdPartyMeasure.getLoadingEthane() == null ? "" : thirdPartyMeasure.getLoadingEthane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Propane(C3H8)-a2", thirdPartyMeasure.getLoadingPropane() == null ? "" : thirdPartyMeasure.getLoadingPropane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Iso Butane(i-C4H10)-a2", thirdPartyMeasure.getLoadingIbutane() == null ? "" : thirdPartyMeasure.getLoadingIbutane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-N-Butane(n-C4H10)-a2", thirdPartyMeasure.getLoadingNbutane() == null ? "" : thirdPartyMeasure.getLoadingNbutane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Iso Pentane(i-C5H12)-a2", thirdPartyMeasure.getLoadingIpentane() == null ? "" : thirdPartyMeasure.getLoadingIpentane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-N-Pentane(n-C5H12)-a2", thirdPartyMeasure.getLoadingNpentane() == null ? "" : thirdPartyMeasure.getLoadingNpentane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-N-Hexane(n-C6H14)-a2", thirdPartyMeasure.getLoadingNhexane() == null ? "" : thirdPartyMeasure.getLoadingNhexane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Nitrogen(N2)-a2", thirdPartyMeasure.getLoadingNitrogen() == null ? "" : thirdPartyMeasure.getLoadingNitrogen().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Oxygen(O2)-a2", thirdPartyMeasure.getLoadingOxygen() == null ? "" : thirdPartyMeasure.getLoadingOxygen().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Carbon Dioxide(CO2)-a2", thirdPartyMeasure.getLoadingDioxide() == null ? "" : thirdPartyMeasure.getLoadingDioxide().toString()));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Methane(CH4)-a4", thirdPartyMeasure.getLoadingMethaneTwo() == null ? "" : thirdPartyMeasure.getLoadingMethaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Ethane(C2H6)-a4", thirdPartyMeasure.getLoadingEthaneTwo() == null ? "" : thirdPartyMeasure.getLoadingEthaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Propane(C3H8)-a4", thirdPartyMeasure.getLoadingPropaneTwo() == null ? "" : thirdPartyMeasure.getLoadingPropaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Iso Butane(i-C4H10)-a4", thirdPartyMeasure.getLoadingIbutaneTwo() == null ? "" : thirdPartyMeasure.getLoadingIbutaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-N-Butane(n-C4H10)-a4", thirdPartyMeasure.getLoadingNbutaneTwo() == null ? "" : thirdPartyMeasure.getLoadingNbutaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Iso Pentane(i-C5H12)-a4", thirdPartyMeasure.getLoadingIpentaneTwo() == null ? "" : thirdPartyMeasure.getLoadingIpentaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-N-Pentane(n-C5H12)-a4", thirdPartyMeasure.getLoadingNpentaneTwo() == null ? "" : thirdPartyMeasure.getLoadingNpentaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-N-Hexane(n-C6H14)-a4", thirdPartyMeasure.getLoadingNhexaneTwo() == null ? "" : thirdPartyMeasure.getLoadingNhexaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Nitrogen(N2)-a4", thirdPartyMeasure.getLoadingNitrogenTwo() == null ? "" : thirdPartyMeasure.getLoadingNitrogenTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Oxygen(O2)-a4", thirdPartyMeasure.getLoadingOxygenTwo() == null ? "" : thirdPartyMeasure.getLoadingOxygenTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Carbon Dioxide(CO2)-a4", thirdPartyMeasure.getLoadingDioxideTwo() == null ? "" : thirdPartyMeasure.getLoadingDioxideTwo().toString()));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Methane(CH4)-a6", thirdPartyMeasure.getDischargeMethane() == null ? "" : thirdPartyMeasure.getDischargeMethane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Ethane(C2H6)-a6", thirdPartyMeasure.getDischargeEthane() == null ? "" : thirdPartyMeasure.getDischargeEthane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Propane(C3H8)-a6", thirdPartyMeasure.getDischargePropane() == null ? "" : thirdPartyMeasure.getDischargePropane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Iso Butane(i-C4H10)-a6", thirdPartyMeasure.getDischargeIbutane() == null ? "" : thirdPartyMeasure.getDischargeIbutane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-N-Butane(n-C4H10)-a6", thirdPartyMeasure.getDischargeNbutane() == null ? "" : thirdPartyMeasure.getDischargeNbutane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Iso Pentane(i-C5H12)-a6", thirdPartyMeasure.getDischargeIpentane() == null ? "" : thirdPartyMeasure.getDischargeIpentane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-N-Pentane(n-C5H12)-a6", thirdPartyMeasure.getDischargeNpentane() == null ? "" : thirdPartyMeasure.getDischargeNpentane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-N-Hexane(n-C6H14)-a6", thirdPartyMeasure.getDischargeNhexane() == null ? "" : thirdPartyMeasure.getDischargeNhexane().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Nitrogen(N2)-a6", thirdPartyMeasure.getDischargeNitrogen() == null ? "" : thirdPartyMeasure.getDischargeNitrogen().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Oxygen(O2)-a6", thirdPartyMeasure.getDischargeOxygen() == null ? "" : thirdPartyMeasure.getDischargeOxygen().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Carbon Dioxide(CO2)-a6", thirdPartyMeasure.getDischargeDioxide() == null ? "" : thirdPartyMeasure.getDischargeDioxide().toString()));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Methane(CH4)-a8", thirdPartyMeasure.getDischargeMethaneTwo() == null ? "" : thirdPartyMeasure.getDischargeMethaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Ethane(C2H6)-a8", thirdPartyMeasure.getDischargeEthaneTwo() == null ? "" : thirdPartyMeasure.getDischargeEthaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Propane(C3H8)-a8", thirdPartyMeasure.getDischargePropaneTwo() == null ? "" : thirdPartyMeasure.getDischargePropaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Iso Butane(i-C4H10)-a8", thirdPartyMeasure.getDischargeIbutaneTwo() == null ? "" : thirdPartyMeasure.getDischargeIbutaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-N-Butane(n-C4H10)-a8", thirdPartyMeasure.getDischargeNbutaneTwo() == null ? "" : thirdPartyMeasure.getDischargeNbutaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Iso Pentane(i-C5H12)-a8", thirdPartyMeasure.getDischargeIpentaneTwo() == null ? "" : thirdPartyMeasure.getDischargeIpentaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-N-Pentane(n-C5H12)-a8", thirdPartyMeasure.getDischargeNpentaneTwo() == null ? "" : thirdPartyMeasure.getDischargeNpentaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-N-Hexane(n-C6H14)-a8", thirdPartyMeasure.getDischargeNhexaneTwo() == null ? "" : thirdPartyMeasure.getDischargeNhexaneTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Nitrogen(N2)-a8", thirdPartyMeasure.getDischargeNitrogenTwo() == null ? "" : thirdPartyMeasure.getDischargeNitrogenTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Oxygen(O2)-a8", thirdPartyMeasure.getDischargeOxygenTwo() == null ? "" : thirdPartyMeasure.getDischargeOxygenTwo().toString()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Carbon Dioxide(CO2)-a8", thirdPartyMeasure.getDischargeDioxideTwo() == null ? "" : thirdPartyMeasure.getDischargeDioxideTwo().toString()));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Methane(CH4)-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Ethane(C2H6)-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Propane(C3H8)-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Iso Butane(i-C4H10)-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-N-Butane(n-C4H10)-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Iso Pentane(i-C5H12)-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-N-Pentane(n-C5H12)-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-N-Hexane(n-C6H14)-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Nitrogen(N2)-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Oxygen(O2)-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Carbon Dioxide(CO2)-a10", thirdPartyMeasure.getRemarks()));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("remarkContent", thirdPartyMeasure.getRemarkContent()));
        } else {
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Port-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Start Date-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-End Date-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Independent-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Port-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Start Date-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-End Date-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Independent-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Port-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Start Date-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-End Date-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Independent-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Port-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Start Date-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-End Date-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Independent-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Port-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Start Date-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-End Date-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Independent-a10", ""));
            //第二个表格
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Gross Quantity-MMBtu-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Gross Quantity-Metric Tons-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Gross Quantity-Cubic Meters-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Net Quantity-MMBtu-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Net Quantity-Metric Tons-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Net Quantity-Cubic Meters-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-COOL DOWN-MMBtu-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-COOL DOWN-Metric Tons-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-COOL DOWN-Cubic Meters-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-VAPOUR-MMBtu-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-VAPOUR-Metric Tons-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-VAPOUR-Cubic Meters-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-BOG CONSUMED-MMBtu-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-BOG CONSUMED-Metric Tons-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-BOG CONSUMED-Cubic Meters-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-GASSING UP-MMBtu-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-GASSING UP-Metric Tons-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-GASSING UP-Cubic Meters-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-GHV-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Temperature-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Density-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-气化率-a2", ""));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Gross Quantity-MMBtu-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Gross Quantity-Metric Tons-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Gross Quantity-Cubic Meters-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Net Quantity-MMBtu-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Net Quantity-Metric Tons-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Net Quantity-Cubic Meters-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-COOL DOWN-MMBtu-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-COOL DOWN-Metric Tons-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-COOL DOWN-Cubic Meters-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-VAPOUR-MMBtu-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-VAPOUR-Metric Tons-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-VAPOUR-Cubic Meters-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-BOG CONSUMED-MMBtu-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-BOG CONSUMED-Metric Tons-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-BOG CONSUMED-Cubic Meters-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-GASSING UP-MMBtu-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-GASSING UP-Metric Tons-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-GASSING UP-Cubic Meters-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-GHV-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Temperature-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Density-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-气化率-a4", ""));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Gross Quantity-MMBtu-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Gross Quantity-Metric Tons-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Gross Quantity-Cubic Meters-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Net Quantity-MMBtu-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Net Quantity-Metric Tons-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Net Quantity-Cubic Meters-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-COOL DOWN-MMBtu-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-COOL DOWN-Metric Tons-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-COOL DOWN-Cubic Meters-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-VAPOUR-MMBtu-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-VAPOUR-Metric Tons-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-VAPOUR-Cubic Meters-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-BOG CONSUMED-MMBtu-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-BOG CONSUMED-Metric Tons-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-BOG CONSUMED-Cubic Meters-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-GASSING UP-MMBtu-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-GASSING UP-Metric Tons-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-GASSING UP-Cubic Meters-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-GHV-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Temperature-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Density-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-气化率-a6", ""));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Gross Quantity-MMBtu-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Gross Quantity-Metric Tons-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Gross Quantity-Cubic Meters-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Net Quantity-MMBtu-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Net Quantity-Metric Tons-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Net Quantity-Cubic Meters-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-COOL DOWN-MMBtu-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-COOL DOWN-Metric Tons-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-COOL DOWN-Cubic Meters-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-VAPOUR-MMBtu-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-VAPOUR-Metric Tons-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-VAPOUR-Cubic Meters-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-BOG CONSUMED-MMBtu-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-BOG CONSUMED-Metric Tons-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-BOG CONSUMED-Cubic Meters-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-GASSING UP-MMBtu-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-GASSING UP-Metric Tons-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-GASSING UP-Cubic Meters-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-GHV-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Temperature-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Density-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-气化率-a8", ""));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Gross Quantity-MMBtu-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Gross Quantity-Tons-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Gross Quantity-Meters-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Net Quantity-MMBtu-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Net Quantity-Tons-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Net Quantity-Meters-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-COOL DOWN-MMBtu-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-COOL DOWN-Tons-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-COOL DOWN-Meters-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-VAPOUR-MMBtu-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-VAPOUR-Tons-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-VAPOUR-Meters-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-BOG CONSUMED-MMBtu-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-BOG CONSUMED-Tons-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-BOG CONSUMED-Meters-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-GASSING UP-MMBtu-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-GASSING UP-Tons-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-GASSING UP-Meters-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-GHV-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Temperature-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Density-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-气化率-a10", ""));
            //第三个表格
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Methane(CH4)-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Ethane(C2H6)-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Propane(C3H8)-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Iso Butane(i-C4H10)-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-N-Butane(n-C4H10)-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Iso Pentane(i-C5H12)-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-N-Pentane(n-C5H12)-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-N-Hexane(n-C6H14)-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Nitrogen(N2)-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Oxygen(O2)-a2", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-Carbon Dioxide(CO2)-a2", ""));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Methane(CH4)-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Ethane(C2H6)-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Propane(C3H8)-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Iso Butane(i-C4H10)-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-N-Butane(n-C4H10)-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Iso Pentane(i-C5H12)-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-N-Pentane(n-C5H12)-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-N-Hexane(n-C6H14)-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Nitrogen(N2)-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Oxygen(O2)-a4", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Loading-2-Carbon Dioxide(CO2)-a4", ""));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Methane(CH4)-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Ethane(C2H6)-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Propane(C3H8)-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Iso Butane(i-C4H10)-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-N-Butane(n-C4H10)-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Iso Pentane(i-C5H12)-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-N-Pentane(n-C5H12)-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-N-Hexane(n-C6H14)-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Nitrogen(N2)-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Oxygen(O2)-a6", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-Carbon Dioxide(CO2)-a6", ""));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Methane(CH4)-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Ethane(C2H6)-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Propane(C3H8)-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Iso Butane(i-C4H10)-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-N-Butane(n-C4H10)-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Iso Pentane(i-C5H12)-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-N-Pentane(n-C5H12)-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-N-Hexane(n-C6H14)-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Nitrogen(N2)-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Oxygen(O2)-a8", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Discharge-2-Carbon Dioxide(CO2)-a8", ""));

            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Methane(CH4)-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Ethane(C2H6)-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Propane(C3H8)-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Iso Butane(i-C4H10)-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-N-Butane(n-C4H10)-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Iso Pentane(i-C5H12)-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-N-Pentane(n-C5H12)-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-N-Hexane(n-C6H14)-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Nitrogen(N2)-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Oxygen(O2)-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("Remarks-Carbon Dioxide(CO2)-a10", ""));
            thirdPartyMeasureDetailBos.add(new ThirdPartyMeasureDetailBo("remarkContent", ""));
        }
        return thirdPartyMeasureDetailBos;
    }

    /**
     * 船务管理第三方计量列表详情导出
     *
     * @param templateUrl
     * @param ids
     * @param fileRecords
     * @param fileServerHost
     * @param listUrl
     * @param listName
     * @return
     */
    @Override
    public JsonResult pageExportAll(String templateUrl, List<Long> ids, List<SpFobFileRecord> fileRecords, String fileServerHost, String listUrl, String listName) throws IOException {
        JsonResult jsonResult = new JsonResult();
        List<File> downloadFiles = new LinkedList<>();
        try {
            URL otherUrl = new URL(listUrl);
            InputStream otherInputStream = otherUrl.openStream();
            File tempFile = File.createTempFile(listName, ".xlsx");
            try (FileOutputStream fileOutputStream = new FileOutputStream(tempFile)) {
                byte[] buffer = new byte[1024];
                int bytesRead;
                while ((bytesRead = otherInputStream.read(buffer)) != -1) {
                    fileOutputStream.write(buffer, 0, bytesRead);
                }
            }
            downloadFiles.add(tempFile);
        } catch (Exception e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
            return JsonResult.failed("文件解析异常！");
        }

        //创建临时压缩文件
        File zipFile = new File("第三方计量报告" + System.currentTimeMillis() + ".zip");
        for (Long id : ids) {
            try {
                //获取运费模板
                URL url = new URL(templateUrl);
                InputStream inputStream = url.openStream();
                Workbook workbook = new XSSFWorkbook(inputStream);

                List<ThirdPartyMeasureDetailBo> detailBos = this.getThirdPartyMeasureExportDetail(id);
                //替换内容
                for (ThirdPartyMeasureDetailBo data : detailBos) {
                    replaceCostText(workbook, data.getName(), data.getValue());
                }

                //动态插入Log
                for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
                    Sheet sheet = workbook.getSheetAt(i);
                    XSSFRow sourceRow = (XSSFRow) sheet.getRow(42);
                    for (Row row : sheet) {
                        for (Cell cell : row) {
                            if (cell.getCellType() == CellType.STRING && cell.getStringCellValue().equals("Loading Time Log")) {
                                List<SmThirdPartyMeasureRecord> thirdPartyMeasureRecords = thirdPartyMeasureRecordMapper.selectList(new LambdaQueryWrapper<SmThirdPartyMeasureRecord>()
                                        .eq(SmThirdPartyMeasureRecord::getThirdPartyMeasureId, id)
                                        .eq(SmThirdPartyMeasureRecord::getRecordType, 1));
                                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
                                int j = 1;
                                int n = 0;
                                for (SmThirdPartyMeasureRecord record : thirdPartyMeasureRecords) {
                                    Row newRow = sheet.createRow(row.getRowNum() + j);
                                    Cell cell0 = newRow.createCell(0);
                                    cell0.setCellValue(dateFormat.format(record.getRecordTime()));
                                    Cell cell1 = newRow.createCell(1);
                                    cell1.setCellValue(record.getRecordContent());
                                    j++;
                                    n = row.getRowNum() + j;
                                }
                                //设置Discharge Time Log标题
                                if (n == 0) {
                                    n = row.getRowNum() + 1;
                                }
                                sheet.addMergedRegion(new CellRangeAddress(n, n, 0, 9));
                                XSSFCellStyle titleStyle = createTitleCellStyle((XSSFWorkbook) workbook);
                                Row newRow = sheet.createRow(n);
                                Cell cell0 = newRow.createCell(0);
                                cell0.setCellValue("Discharge Time Log");
                                cell0.setCellStyle(titleStyle);
                                //设置Discharge Time Log内容
                                List<SmThirdPartyMeasureRecord> thirdPartyMeasureDischarRecords = thirdPartyMeasureRecordMapper.selectList(new LambdaQueryWrapper<SmThirdPartyMeasureRecord>()
                                        .eq(SmThirdPartyMeasureRecord::getThirdPartyMeasureId, id)
                                        .eq(SmThirdPartyMeasureRecord::getRecordType, 2));
                                for (SmThirdPartyMeasureRecord record : thirdPartyMeasureDischarRecords) {
                                    Row newDischargeRow = sheet.createRow(n + 1);
                                    Cell cellDischarge0 = newDischargeRow.createCell(0);
                                    cellDischarge0.setCellValue(dateFormat.format(record.getRecordTime()));
                                    Cell cell1 = newDischargeRow.createCell(1);
                                    cell1.setCellValue(record.getRecordContent());
                                }
                                //设置备注内容
                                XSSFCellStyle cellStyle = (XSSFCellStyle) workbook.createCellStyle();
                                XSSFFont headerFont1 = (XSSFFont) workbook.createFont(); // 创建字体样式
                                headerFont1.setBold(false); //字体加粗
                                headerFont1.setFontName("Times New Roman"); // 设置字体类型
                                headerFont1.setFontHeightInPoints((short) 12); // 设置字体大小
                                cellStyle.setFont(headerFont1); // 为标题样式设置字体样式

                                Row newRemarkRow = sheet.createRow(n + 3);
                                Cell cellRemark0 = newRemarkRow.createCell(0);
                                cellRemark0.setCellValue("备注内容");
                                cellRemark0.setCellStyle(cellStyle);
                                SmThirdPartyMeasure thirdPartyMeasure = this.getBaseMapper().selectById(id);
                                Cell cellRemark1 = newRemarkRow.createCell(1);
                                if (null != thirdPartyMeasure) {
                                    cellRemark1.setCellValue(thirdPartyMeasure.getRemarkContent());
                                } else {
                                    cellRemark1.setCellValue("");
                                }
                            }
                            break;
                        }
                    }
                }
                //相关附件
                if (null != fileRecords && fileRecords.size() > 0) {
                    for (SpFobFileRecord f : fileRecords) {
                        //文件下载进压缩包
                        String fileUrl = f.getPath();

                        URL otherUrl = new URL(fileUrl);
                        InputStream otherInputStream = otherUrl.openStream();
                        String[] nameArr = f.getName().split("\\.");
                        File tempFile = File.createTempFile(nameArr[0], "." + nameArr[1]);
                        try (FileOutputStream fileOutputStream = new FileOutputStream(tempFile)) {
                            byte[] buffer = new byte[1024];
                            int bytesRead;
                            while ((bytesRead = otherInputStream.read(buffer)) != -1) {
                                fileOutputStream.write(buffer, 0, bytesRead);
                            }
                        }
                        downloadFiles.add(tempFile);
                    }
                }

                File tempFile = File.createTempFile("第三方计量报告明细", ".xlsx");
                //创建输出流
                FileOutputStream fileOutputStream = new FileOutputStream(tempFile);
                workbook.write(fileOutputStream);
                fileOutputStream.close();
                downloadFiles.add(tempFile);
                System.out.println("循环中downloadFiles："+downloadFiles);
                try (FileOutputStream fos = new FileOutputStream(zipFile);
                     ZipOutputStream zos = new ZipOutputStream(fos)) {
                    for (File downloadFile : downloadFiles) {
                        ZipEntry zipEntry = new ZipEntry(downloadFile.getName());
                        zos.putNextEntry(zipEntry);
                        try (FileInputStream fis = new FileInputStream(downloadFile)) {
                            byte[] buffer = new byte[1024];
                            int length;
                            while ((length = fis.read(buffer)) > 0) {
                                zos.write(buffer, 0, length);
                            }
                        }
                        zos.closeEntry();
                        downloadFile.delete();
                    }
                }

            } catch (Exception e) {
                System.out.println(e.getMessage());
                e.printStackTrace();
                return JsonResult.failed("文件解析异常！");
            }
        }
        FileInputStream input = new FileInputStream(zipFile);
        MultipartFile multipartFile = new MockMultipartFile("file", zipFile.getName(), "application/octet-stream", input);
        R<SysFile> result1 = remoteFileService.upload(multipartFile);
        if(result1.getCode() != R.SUCCESS){
            throw new BusException("文件服务器连接失败", BaseResultCode.GENERAL_ERROR);
        }
        String url = result1.getData().getHttpsUrl();
//        //文件
//        paramMap.put("file", zipFile);
//        //输出
//        paramMap.put("output", "json");
//        //自定义路径
//        paramMap.put("path", "zip");
//        //场景
//        paramMap.put("scene", "zip");
//
//        paramMap.put("filename", zipFile.getName());
        //上传
//        String result = HttpUtil.post(fileServerHost + "/group1/upload", paramMap);
//        Gson gson = new Gson();
//        JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
        zipFile.delete();
        return JsonResult.success(url);
    }
}
